Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- npm init
- touch app.js
- touch .gitigore
- vim .gitignore
- node_modules
- :wq
- npm install body-parser hbs express morgan
- npm nodemon
- IN PACKAGES.JS
- "dev": "nodemon app.js"
- IN APP.JS
- const express = require('express');
- const app = express();
- const hbs = require('hbs');
- /* EXPRESS CONFIG */
- const publicDir = __dirname + "/public";
- app.use(express.static(publicDir));
- app.set("views", __dirname + "/views");
- app.set("view engine", "hbs");
- hbs.registerPartials(__dirname + "/views/partials");
- /* SERVER LISTENER */
- const port = 3000;
- app.listen(port, () => console.log(`Listening on port ${port}`));
Add Comment
Please, Sign In to add comment