Skip to content

Conversation

@kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Jan 4, 2026

The following PR caused 2 regressions:
#1066

Test Plan

  1. The middleware is now loaded before the dev server starts. You can test this by running npm run dev and go to localhost:3000/login/ and see that it redirects to localhost:300/login/ now.

  2. The mocks of index.ts are now loaded correctly. You can test this by going to npm run dev and see the message 🔶 Mock server installed in the console.

Checklist

  • Tests updated
  • Docs updated

Screenshots

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two regressions introduced in PR #1066 by correcting the middleware loading order and ensuring mocks are loaded before the development server starts.

Key Changes:

  • Moved Vite/production middleware to load after all other Express middleware in server/index.ts
  • Updated dev scripts to run index.ts instead of server/index.ts to ensure mocks are loaded first

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
server/index.ts Moved the Vite dev server and production middleware block from immediately after app creation to after all other middleware (HTTPS redirect, trailing slash removal, compression, helmet, rate limiting, etc.), ensuring proper middleware execution order
package.json Updated dev and dev:no-mocks scripts to run index.ts instead of server/index.ts, making them consistent with the start scripts and ensuring mocks are loaded before the server starts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kentcdodds kentcdodds merged commit 1c09b52 into epicweb-dev:main Jan 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants