-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
26 lines (22 loc) · 914 Bytes
/
server.js
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
const init = require('./db/init.sequelize.js');
const config = require('./config/connection.server.js');
const db = require('./db/models.sequelize.js');
const express = require('express');
const path = require('path');
const exphbs = require('express-handlebars');
const routes = require('./routes/routes');
const bodyParser = require('body-parser');
var app = express()
app.set('views', path.join(__dirname, '/views/'));
app.engine('hbs', exphbs({ extname: 'hbs', defaultLayout: 'mainLayout', layoutsDir: __dirname + '/views/layout/' }))
app.set('view engine', 'hbs')
app.listen(process.env.PORT || config.port, () => {
console.log("Express server is started at port : " + config.port);
})
app.use(bodyParser.urlencoded({
extended: true
}))
app.use(bodyParser.json())
app.use(express.static(path.join(__dirname, '/views/assets/')));
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
app.use('/', routes)