-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (28 loc) · 863 Bytes
/
server.js
File metadata and controls
35 lines (28 loc) · 863 Bytes
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
var path = require('path');
var express = require('express');
var bodyParser = require('body-parser');
var fs = require('fs');
var app = express();
var http = require('http').Server(app);
var port = process.env.PORT || '5000';
if (!process.env.PORT) {
global.isDevelopment = true;
} else {
if (process.env.PORT === port ) {
global.isDevelopment = true;
} else {
global.isDevelopment = false;
}
}
app.use(bodyParser.urlencoded({ extended: true}));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'app')));
app.set('port', port);
//Server kickstart:
http.listen(app.get('port'), function() {
console.log('Is Development :'+global.isDevelopment);
servicesKickstart();
});
function servicesKickstart() {
console.log("Yo! The API is up on " + app.get('port'));
}