-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
28 lines (24 loc) · 902 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
27
28
// Ekapob Ukritnukun
// ThaiGQ@gmail.com
// March 02, 2017
// Track: MEAN
// MEAN Belt Exam: D - Doctor Appointment
var express = require( 'express' ),
path = require( 'path' ),
bp = require('body-parser'),
root = __dirname,
port = process.env.PORT || 8000,
app = express();
app.use( express.static( path.join( root, 'client' )));
app.use( express.static( path.join( root, 'bower_components' )));
app.use( bp.json() );
// require the mongoose configuration file which does the rest for us
require('./server/config/mongoose.js');
require("./server/config/routes.js")(app);
// store the function in a variable
var routes_setter = require('./server/config/routes.js');
// invoke the function stored in routes_setter and pass it the "app" variable
routes_setter(app);
app.listen( port, function() {
console.log( `server running on port ${ port }` );
});