-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
57 lines (39 loc) · 1.28 KB
/
app.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
const express = require("express");
const app = express();
const helpers = require("./helpers/index");
const Booter = require("./bootstrap/index");
let bodyParser = require('body-parser');
let cors = require("cors");
const path = require('path');
// init booter
Booter(app);
// due to the asynchronous nature of some bootables in the above
// we will observe 300ms silence then proceed to executing the remaining
const serverStart= async () => {
console.warn("waiting for booters...");
app.use(cors());
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));
await sleep(300);
const PostBooter = require("./bootstrap/post-index");
PostBooter(app);
console.log("proceeding to server start");
const userMiddleWare = require('./app/Model/user');
const port = 3003;
// set template engine
// app.set('view engine', 'hbs')
// set view engine
// app.set('views', path.join(__dirname, 'resources/view'))
app.use(express.static('public'))
// console.clear();
app.listen(port, () => {
console.log("This app is listening on port " + port);
});
};
var sleep = (duration) => {
return new Promise((resolve) => {
setTimeout(resolve, duration);
});
};
serverStart();