wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
12.7k stars 1.13k forks source link

Enabling CRUD feature sets the default middleware globally (breaking the API feature) #2121

Open infomiho opened 1 week ago

infomiho commented 1 week ago

The way we define CRUD router and the apis router is conflicting.

router.use('/', middleware, rootCrudRouter)
router.use(apis)

The router.use('/', middleware, ...) code sets the defaultmiddleware for all the routes under / which is ... all routes 😄 This breaks the custom middleware option of the custom API routes feature.

Related Discord thread: https://ptb.discord.com/channels/686873244791210014/1253382715135234211/1253707556614832160

Possible fixes