Closed BounSweFerhatSal closed 1 year ago
when creating a router as below in a separate file , to use as a base as below :
import { createRouter } from "next-connect"; const pipeLineRouter = createRouter(); export default pipeLineRouter .use(jwtTokenValidator_middleware) .use(dbConnection_middleware);
then importing in another API file by cloning the router as below (as suggested) :
import apiPipeline from "/lib/apiPipeline"; const router = apiPipeline.clone(); router.get(async (req, res) => { //...... }); export default router.handler(errorCather);
router.handler() fails with error :
TypeError: router.handler is not a function
However, console.log(router) gives exact same router object properties which has been cloned.
This is a bug, I am fixing it right now
This is fixed in latest next version. Let me know if you still face it.
next
when creating a router as below in a separate file , to use as a base as below :
then importing in another API file by cloning the router as below (as suggested) :
router.handler() fails with error :
TypeError: router.handler is not a function
However, console.log(router) gives exact same router object properties which has been cloned.