2
0
mirror of https://github.com/frappe/books.git synced 2025-01-25 16:18:33 +00:00

Manually register staticPath in express

This commit is contained in:
Faris Ansari 2018-08-10 17:41:48 +05:30
parent f57f4267c8
commit 666c4969aa
2 changed files with 7 additions and 2 deletions

View File

@ -25,7 +25,7 @@ require.extensions['.html'] = function (module, filename) {
}; };
module.exports = { module.exports = {
async start({backend, connectionParams, models, staticPath = './', authConfig=null}) { async start({backend, connectionParams, models, authConfig=null}) {
await this.init(); await this.init();
if (models) { if (models) {
@ -38,6 +38,11 @@ module.exports = {
// app // app
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
for (let staticPath of [appConfig.distPath, appConfig.staticPath]) {
app.use(express.static(staticPath));
}
app.use(morgan('tiny')); app.use(morgan('tiny'));
if (connectionParams.enableCORS) { if (connectionParams.enableCORS) {

View File

@ -87,7 +87,7 @@ function getConfig() {
noEmitOnErrors: false noEmitOnErrors: false
}, },
devServer: { devServer: {
contentBase: './dist', // contentBase: './dist', // dist path is directly configured in express
hot: true, hot: true,
quiet: true quiet: true
}, },