forked from wavesplatform/WavesExplorerLite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (28 loc) · 933 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
31
32
33
34
35
'use strict';
var express = require('express');
var http = require('http');
var path = require('path');
var favicon = require('serve-favicon');
var morgan = require('morgan'); // formerly express.logger
var errorhandler = require('errorhandler');
var app = express();
var basedir = __dirname + '/build';
// all environments
app.set('port', process.env.PORT || 3000);
// //app.set('views', path.join(__dirname, 'views'));
// app.engine('html', require('ejs').renderFile);
// express/connect middleware
app.use(favicon(basedir + '/favicon.ico'));
app.use(morgan('dev'));
// serve up static assets
app.use(express.static(basedir));
app.get('/*', function(req, res){
res.sendFile(basedir + '/index.html');
});
// development only
if ('development' === app.get('env')) {
app.use(errorhandler());
}
http.createServer(app).listen(app.get('port'), function () {
console.log('Server listening on port ' + app.get('port'));
});