1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Map entire dist/ folder as /static in server to allow for dynamic chunking

Otherwise we’d have to change the mapping every time we add or remove a
chunk.
This commit is contained in:
Brett Sun 2016-06-02 17:08:59 +02:00
parent 173d3d19b7
commit 1a8691bc53

View File

@ -12,12 +12,7 @@ const PORT = process.env.ONION_PORT || 4000;
const app = express(); const app = express();
app.use(compression()); app.use(compression());
app.use(path.resolve(BASE_PATH, '/static'), express.static(path.resolve(__dirname, 'dist')));
app.use(path.join(BASE_PATH, '/static/js'), express.static(path.resolve(__dirname, 'dist/js')));
app.use(path.join(BASE_PATH, '/static/css'), express.static(path.resolve(__dirname, 'dist/css')));
app.use(path.join(BASE_PATH, '/static/fonts'), express.static(path.resolve(__dirname, 'dist/fonts')));
app.use(path.join(BASE_PATH, '/static/third_party'),
express.static(path.resolve(__dirname, 'dist/third_party')));
app.get(/.*/, (req, res) => { app.get(/.*/, (req, res) => {
console.log('%s %s', req.method, req.path); console.log('%s %s', req.method, req.path);