-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
55 lines (41 loc) · 971 Bytes
/
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
/**
* APPLICATION Main file.
*/
/**
* importing app dependencies
*/
const express = require ('express');
const cors = require ('cors');
const mongoose = require ('mongoose');
/**
* importing app internal modules
*/
const config = require ('./config/index');
const router = require ( './routes/index');
const dbConection = require ( './helpers/database.connection');
//Instanciating Express App
const app = express ();
/**
* Application settings
*/
app.use (express.json ());
app.use (express.urlencoded ( {extended: true} ));
app.use(cors());
/**
* Application middlewares
*/
//generating token
//const generatingToken = (req, res, next) => {
//}
/**
* Application APIs
*/
app.use('/', router);
//Launching express server
app.listen (config.port, (err) => {
if ( !err) {
console.log (`Express server listening on http://localhost:${config.port}`);
}else {
console.log ( 'Error starting Express Application!');
};
});