Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
fix(server): use reduce on exportServer instead of forEach
Browse files Browse the repository at this point in the history
  • Loading branch information
ostowe committed May 28, 2020
1 parent 5fdab32 commit bb849ef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/core/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ app.use((err, req, res, next) => {

// Run all export server functions.
const serverExportMiddleware = getConfigField('exportServer');
serverExportMiddleware.forEach((middleware) => middleware(app));

module.exports = app;
module.exports = serverExportMiddleware.reduce(
(acc, middleware) => {
const exportApp = middleware(app);

if (exportApp) {
return exportApp;
}

return acc;
},
app
);

0 comments on commit bb849ef

Please sign in to comment.