feat(cli-serve): add snapshotting capability (#129)

This commit is contained in:
Miralem Drek
2019-10-08 15:28:26 +02:00
committed by GitHub
parent 3220de9e9b
commit a47e7b4c9b
9 changed files with 327 additions and 56 deletions

View File

@@ -5,6 +5,8 @@ const chalk = require('chalk');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const snapshotter = require('./snapshot');
module.exports = async ({
host,
port,
@@ -19,6 +21,11 @@ module.exports = async ({
let config;
let contentBase;
const snapper = snapshotter({
host,
port,
});
if (dev) {
const webpackConfig = require('./webpack.build.js');
const srcDir = path.resolve(__dirname, '../web');
@@ -56,6 +63,8 @@ module.exports = async ({
index: '/eHub.html',
},
before(app) {
snapper.addRoutes(app);
app.get('/info', (req, res) => {
res.json({
enigma: enigmaConfig,