fix middleware order (#1865)

This commit is contained in:
Fred K. Schott 2021-11-17 12:40:30 -08:00 committed by GitHub
parent 850693957c
commit 6b598b2401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix middleware order

View file

@ -83,8 +83,8 @@ export class AstroDevServer {
// Setup the dev server and connect it to Vite (via middleware) // Setup the dev server and connect it to Vite (via middleware)
this.viteServer = await this.createViteServer(); this.viteServer = await this.createViteServer();
this.app.use((req, res, next) => this.handleRequest(req, res, next));
this.app.use(this.viteServer.middlewares); this.app.use(this.viteServer.middlewares);
this.app.use((req, res, next) => this.handleRequest(req, res, next));
this.app.use((req, res, next) => this.renderError(req, res, next)); this.app.use((req, res, next) => this.renderError(req, res, next));
// Listen on port (and retry if taken) // Listen on port (and retry if taken)