-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (31 loc) · 1.11 KB
/
index.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require('./models/routes')
const express = require('express')
const path = require('path')
const handlebars = require('handlebars')
const exphbs = require('express-handlebars')
const {allowInsecurePrototypeAccess} = require('@handlebars/allow-prototype-access')
const bodyparser = require('body-parser')
const { engine } = require('express-handlebars');
const routes_controller = require('./controllers/routes_controller')
var app = express();
app.use(bodyparser.urlencoded({extended: false}))
app.use(bodyparser.json())
app.get('/', (req, res) => {
res.send(`
<h2>Welcome to REMOTE CONNECTION</h2>
<h3>Click hereto get access to the <b> <a href="/router/list">DATABASE</a></b></h3>
`);
});
app.set('views', path.join(__dirname, "/views/"));
app.engine('hbs', exphbs.engine({
handlebars: allowInsecurePrototypeAccess(handlebars),
extname: 'hbs',
defaultLayout: "MainLayout",
layoutsDir: __dirname + "/views/layouts/",
})
);
app.set('view engine', 'hbs');
app.listen(3000, () => {
console.log("server started at port 3000")
});
app.use('/router', routes_controller);