Last active
November 8, 2020 04:41
-
-
Save rockpell/e8b04961bb58a4f2fecae5efea7982ed to your computer and use it in GitHub Desktop.
express sample code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const passport = require('passport'); | |
require('dotenv').config(); | |
const indexRouter = require('./routes/index'); | |
const port = process.env.PORT || 3000; | |
const app = express(); | |
app.use(passport.initialize()); | |
app.use(express.json()); | |
app.use(express.urlencoded({ extended: false })); | |
app.use('/', indexRouter); | |
app.listen(port, () => { | |
console.log(`server is running on ${port}`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const router = express.Router(); | |
router.get('/', (req, res) => { | |
res.send('hello'); | |
}); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment