forked from mariuszm/ng-devstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (26 loc) · 1.04 KB
/
server.js
File metadata and controls
32 lines (26 loc) · 1.04 KB
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
/* jshint strict: false */
/*
More on LiveReload: http://rhumaric.com/2014/01/livereload-magic-gulp-style/
*/
module.exports = function (lr) {
var express = require('express'),
app = express(),
http = require('http'),
serveIndex = require('serve-index'),
serveStatic = require('serve-static'),
EXPRESS_ROOT = 'build',
EXPRESS_PORT = 4000,
LIVERELOAD_PORT = 35729;
// Uncomment following line if html5Mode is enabled.
// app.use(require('connect-modrewrite')(['!\\.\\w+$ /index.html']));
app.use(require('connect-livereload')({ port: LIVERELOAD_PORT }));
app.use(serveStatic(EXPRESS_ROOT));
app.use('/', serveIndex(EXPRESS_ROOT));
var server = http.createServer(app);
server.listen(EXPRESS_PORT);
server.on('listening', function () {
console.log('Running at\n => http://localhost:' + EXPRESS_PORT + '/');
require('open')('http://localhost:' + EXPRESS_PORT);
});
lr.listen(LIVERELOAD_PORT);
};