File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,15 +31,17 @@ export function buildServer(dataFilePath, options = {}) {
3131
3232 const httpServer = polka ( ) ;
3333
34+ const asyncStoreProperties = { } ;
3435 if ( runFromPayload ) {
3536 fs . accessSync ( dataFilePath , fs . constants . R_OK | fs . constants . W_OK ) ;
36- httpServer . use (
37- middlewares . buildContextMiddleware ( dataFilePath , hotReload )
38- ) ;
37+ asyncStoreProperties . dataFilePath = dataFilePath ;
3938 }
4039 else {
4140 appCache . startFromZero = true ;
4241 }
42+ httpServer . use (
43+ middlewares . buildContextMiddleware ( hotReload , asyncStoreProperties )
44+ ) ;
4345
4446 httpServer . use ( middlewares . addStaticFiles ) ;
4547 httpServer . get ( "/" , root . get ) ;
Original file line number Diff line number Diff line change @@ -3,15 +3,15 @@ import { context } from "../../ALS.js";
33import { ViewBuilder } from "../ViewBuilder.class.js" ;
44
55export function buildContextMiddleware (
6- dataFilePath ,
7- autoReload = false
6+ autoReload = false ,
7+ storeProperties = { }
88) {
99 const viewBuilder = new ViewBuilder ( {
1010 autoReload
1111 } ) ;
1212
1313 return function addContext ( _req , _res , next ) {
14- const store = { dataFilePath , viewBuilder } ;
14+ const store = { ... storeProperties , viewBuilder } ;
1515 context . run ( store , next ) ;
1616 } ;
1717}
You can’t perform that action at this time.
0 commit comments