-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (40 loc) · 1.09 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
41
42
43
44
45
46
47
48
49
50
/**
* @author : Manjeet Kumar
* @description : main driver file for the application, creates an express app and starts the server
*/
//load environment variables
require('dotenv').config({ path: './variables.env' });
const express = require('express');
const bodyParser = require('body-parser');
const configs = require('./configs');
const router = require('./routes');
//create an express app
const app = express();
initializeUserDataStore();
//set app configs
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(router);
//start the server
app.listen(configs.port, (err)=> {
if(!err) {
console.log('app is up and running on PORT :',configs.port);
} else {
console.log('Error while starting the server =>', err);
}
});
function initializeUserDataStore() {
global.ROOT = __dirname;
global.users = {
1: {
username: 'Manjeet',
password: 'sbs',
dob: '',
email: '',
isUserName: 0,
isPassword: 0,
isEmail: 0,
isDOB: 0
}
};
}