joyent-portal/backend/src/index.js

32 lines
557 B
JavaScript
Raw Normal View History

2016-10-20 15:36:24 +03:00
const path = require('path');
const express = require('express');
const st = require('st');
const app = express();
var mount = st({
path: path.join(__dirname, '../static'),
url: 'static/',
index: 'index.html',
dot: false,
passthrough: false,
gzip: true,
cors: false
});
app.use(mount);
app.get('/*', (req, res, next) => {
mount(Object.assign(req, {
sturl: '/static/index.html'
}), res, next);
});
app.listen(8000, (err, address) => {
if (err) {
throw err;
}
console.log('Server running at: http://localhost:8000');
});