-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (21 loc) · 680 Bytes
/
server.js
File metadata and controls
28 lines (21 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require('dotenv').config()
var express = require('express');
var hbs = require('express-handlebars');
var Router = require('./router');
var app = express();
app.set('views', (__dirname, 'views'));
app.set('view engine', 'hbs');
var bodyParser = require("body-parser");
app.use(bodyParser.json())
app.engine('hbs', hbs({
extname: 'hbs',
defaultLayout: 'index',
layoutsDir: __dirname + '/views/layout/'
}));
app.use(express.urlencoded({ extended: false }));
app.use(express.static(__dirname + '/public'));
app.use('/', Router);
module.exports = app;
app.listen(process.env.PORT || 3000, () => {
console.log(`Server is running on PORT ${process.env.PORT}`);
})