Advertisement
xapu

Untitled

Oct 7th, 2017
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var express = require('express');
  2. var path = require('path');
  3. var app = express();
  4. var exphbs = require(‘express-handlebars’); app.engine('handlebars',
  5. exphbs({defaultLayout: 'main'})); app.set('view engine', 'handlebars');
  6. app.set('port', process.env.PORT || 3000);
  7. var options = { dotfiles: 'ignore', etag: false,
  8. extensions: ['htm', 'html'],
  9. index: false
  10. };
  11. app.use(express.static(path.join(__dirname, 'public') , options  ));
  12. app.get('/', function(req, res)
  13. {
  14. res.render('hello');   // this is the important part
  15. });
  16. app.get('/bodie', function(req, res)
  17. {
  18. res.render('bodie');
  19. });
  20. app.get('/june', function(req, res)
  21. {
  22. res.render('june');
  23. });
  24. app.listen(app.get('port'),  function () {
  25. console.log('Hello express started on http://localhost:' +
  26. app.get('port') + '; press Ctrl-C to terminate.' );
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement