forked from ordercloud-api/angular-buyer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (29 loc) · 1.14 KB
/
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
'use strict';
var config = require('./gulp.config');
var express = require('express'),
env = process.env.NODE_ENV = process.env.NODE_ENV || 'dev',
app = express(),
port = process.env.PORT || 451;
switch(env) {
case 'production':
console.log('*** PROD ***');
app.use(express.static(config.root + config.compile.replace('.', '')));
app.get('/*', function(req, res) {
res.sendFile(config.root + config.compile.replace('.', '') + 'index.html');
});
break;
default:
console.log('*** DEV ***');
// Host bower_files
app.use('/bower_files', express.static(config.root + config.bowerFiles.replace('.', '')));
// Host unminfied javascript files
app.use(express.static(config.root + config.build.replace('.', '')));
// Host unchanged html files
app.use(express.static(config.root + config.src.replace('.', '') + 'app/'));
app.get('/*', function(req, res) {
res.sendFile(config.root + config.build.replace('.', '') + 'index.html');
});
break;
}
app.listen(port);
console.log('Listening on port ' + port + '...');