-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (23 loc) · 861 Bytes
/
Copy pathapp.js
File metadata and controls
29 lines (23 loc) · 861 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
29
require('./models/db');
const express = require('express');
const exphbs = require('express-handlebars');
const path = require('path');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.urlencoded({extended : true}));
app.use(bodyParser.json());
app.set('views', path.join(__dirname, './views'));
app.engine('hbs', exphbs({
extname : 'hbs',
defaultLayout : 'mainLayout',
layoutsDir : __dirname + '/views/layouts',
runtimeOptions : {
allowProtoPropertiesByDefault : true,
allowProtoMethodsByDefault : true
}
}));
app.set('view engine', 'hbs');
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {console.log(`Node Server is listening to port ${PORT}.`)});
const employeeControllers = require('./controllers/employeeControllers');
app.use('/', employeeControllers);