Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. const express = require('express');
  2. const path = require('path');
  3. const port = 3000;
  4. const app = express();
  5. app.set('views', path.join(__dirname, 'views'));
  6. app.set('view engine', 'ejs');
  7. app.get('/', function(req, res, next) {
  8. res.render('index', {
  9. title: 'I lied'
  10. });
  11. });
  12. app.use(function(err, req, res, next) {
  13. res.locals.message = err.message;
  14. res.locals.error = req.app.get('env') === 'development' ? err : {};
  15. res.status(err.status || 500);
  16. res.render('error');
  17. });
  18. app.listen(port, () => console.log(`App listening on port ${port}`));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement