Skip to content

Instantly share code, notes, and snippets.

@rockpell
Last active November 8, 2020 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockpell/e8b04961bb58a4f2fecae5efea7982ed to your computer and use it in GitHub Desktop.
Save rockpell/e8b04961bb58a4f2fecae5efea7982ed to your computer and use it in GitHub Desktop.
express sample code
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}`);
});
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