-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
30 lines (23 loc) · 828 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
29
30
var express = require('express');
var path = require('path');
var serveStatic = require('serve-static');
var environment = require('serve-static');
app = express();
console.log(process.env.NODE_ENV);
var morgan = require('morgan')
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
app.use(morgan('dev'))
} else {
app.use(morgan('short'))
}
app.use(serveStatic(__dirname + "/build"));
var port = process.env.PORT || 5000;
process.env.NODE_ENV = 'production';
app.listen(port);
console.log('');
console.log('**************************************');
console.log('* Express.js server started *');
console.log('* Port: '+port+' *');
console.log('* Listening on http://localhost:'+port+' *');
console.log('**************************************');
console.log('');