Reordered how things are setup in the Intializer so that static files get treated properly

This commit is contained in:
Alan Bridgeman 2025-04-30 22:02:59 -05:00
parent b32c58f292
commit ebe1532873

View file

@ -98,15 +98,6 @@ export class Initializer {
// Setup global middleware // Setup global middleware
await this.setupMiddleware(app); await this.setupMiddleware(app);
// Setup the router (how the app handles requests)
if(typeof this.controllersPath !== 'undefined') {
this.router = new Router(this.controllersPath);
}
else {
this.router = new Router();
}
await this.router.setup(app);
// Setup the static file resolver (how the app serves static files) // Setup the static file resolver (how the app serves static files)
if(typeof this.staticFilesPath !== 'undefined') { if(typeof this.staticFilesPath !== 'undefined') {
await (new StaticFileResolver(this.staticFilesPath)).setup(app); await (new StaticFileResolver(this.staticFilesPath)).setup(app);
@ -127,5 +118,14 @@ export class Initializer {
else { else {
await (new Renderer()).setup(app); await (new Renderer()).setup(app);
} }
// Setup the router (how the app handles requests)
if(typeof this.controllersPath !== 'undefined') {
this.router = new Router(this.controllersPath);
}
else {
this.router = new Router();
}
await this.router.setup(app);
} }
} }