Guest User

Untitled

a guest
Apr 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. npm init
  2. touch app.js
  3. touch .gitigore
  4. vim .gitignore
  5. node_modules
  6. :wq
  7. npm install body-parser hbs express morgan
  8. npm nodemon
  9.  
  10.  
  11. IN PACKAGES.JS
  12. "dev": "nodemon app.js"
  13.  
  14.  
  15. IN APP.JS
  16.  
  17.  
  18. const express = require('express');
  19. const app = express();
  20. const hbs = require('hbs');
  21.  
  22.  
  23. /* EXPRESS CONFIG */
  24.  
  25. const publicDir = __dirname + "/public";
  26. app.use(express.static(publicDir));
  27.  
  28.  
  29. app.set("views", __dirname + "/views");
  30. app.set("view engine", "hbs");
  31. hbs.registerPartials(__dirname + "/views/partials");
  32.  
  33.  
  34. /* SERVER LISTENER */
  35. const port = 3000;
  36. app.listen(port, () => console.log(`Listening on port ${port}`));
Add Comment
Please, Sign In to add comment