Is it possible to add middleware to API routes?
Hi all, is it possible to add middleware to API routes? I need to implement authentication but couldn’t find relevant documentation. Any guidance or resources would be appreciated! Thanks in advance!
7 Replies
modern-teal•9mo ago
Sure.
Do u wanna add Nuddkeware to globally or specific routes?
stormy-goldOP•9mo ago
examples on how to do both would be great, thanks.
rival-black•9mo ago
which kind of middleware do you want to add?
server function Middleware?
nitro Middleware?
stormy-goldOP•9mo ago
nitro middleware (I suppose). I want to add middleware to API routes.
stormy-gold•8mo ago
Ah middleware for API routes and not for server functions.
not sure if this is helpful
stormy-gold•8mo ago
Event Handler - h3
Event handlers define application logic.
stormy-gold•8mo ago
all i know is that nitro is using h3 under the hood.