-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlauncher.js
More file actions
27 lines (25 loc) · 725 Bytes
/
launcher.js
File metadata and controls
27 lines (25 loc) · 725 Bytes
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
var express = require('express');
var app = express();
var path = require('path');
var bodyParser = require('body-parser');
var PORT = process.env.PORT || 9000;
// url encoding
app.use(bodyParser.urlencoded({extended:false}));
// gzip
// redirect all html requests to `index.html`
app.use(function (req, res, next) {
if (path.extname(req.path).length > 0) {
// normal static file request
next();
}
else {
// should force return `index.html` for angular.js
req.url = '/index.html';
next();
}
});
// static file serve
app.use(express.static(path.join(__dirname, 'static/')));
app.listen(PORT, function() {
console.log('Express server listening on port' + PORT);
});