blomqma / next-rest-framework

Type-safe, self-documenting APIs for Next.js
https://next-rest-framework.vercel.app
Other
136 stars 18 forks source link

Middleware #89

Closed SaadBazaz closed 10 months ago

SaadBazaz commented 10 months ago

Obviously the easy path is to go for NextJS middleware.

But maybe we can have a similar concept here? Or some docs on how we can achieve it with the current version of NRF?

The reason why I ask is because of NextAuth. Most projects use that.

blomqma commented 10 months ago

Yeah, some kind of middleware logic makes sense, and some of the earlier versions even contained some middleware logic but that wasn't introduced to the latest client API yet. v3.2.0 adds a Middleware function that allows executing logic before the request input is validated. Does this resolve your issue?