mirror of
https://github.com/yldio/copilot.git
synced 2024-11-11 05:40:11 +02:00
32 lines
557 B
JavaScript
32 lines
557 B
JavaScript
|
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');
|
||
|
});
|