Closed RadoslavMarinov closed 2 years ago
My mistake it is possible actually. This works
handler.get(...validateGetReq(), async(req:NextApiRequest, res:NextApiResponse)=>{ handler.delete(...validateDeleteReq(),async(req:NextApiRequest, res:NextApiResponse)=>{
In Express we can do it by adding the middleware into the method like so:
app.get('/user/:userId', getMiddleware, (req,res)=>....
app.delete('/user/:userId', deleteMiddleware, (req,res)=>....
How to do the trick in next-connect? If I apply middleware to the GET it will always trigger for the DELETE method as well. I want really separate independent middleware for the two methods