-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
34 lines (28 loc) · 1.01 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
33
34
var express = require('express'),
app = express(),
serveStatic = require('serve-static'),
path = require('path'),
babel = require('babel-middleware'),
http = require('http'),
httpServer = http.Server(app),
argv = require("yargs").argv,
proxyServer = require('http-route-proxy'),
port = process.env.PORT || argv.port || 9000,
appName = argv.app,
host = process.env.HOST || argv.host || 'localhost',
target = (argv.dist ? '/dist/' : '/src/') + appName + '/';
app.use(express.static(path.join(__dirname, target)));
app.use(serveStatic(path.join(__dirname, target), {
'index': ['index.html']
}));
// app.use(serveStatic(path.join(__dirname, target)),
// babel({
// srcPath: path.join(__dirname, target),
// cachePath: __dirname + '/_cache',
// babelOptions: {
// presets: ['es2015']
// }
// })
// );
app.listen(port, host);
console.log('Server is runnig at ' + host + ':' + port + '\nTarget: ' + target + '\nApp: ' + appName);