function runMiddleware(req, res, fn) {
        return new Promise((resolve, reject) => {
          fn(req, res, (result) => {
            if (result instanceof Error) {
              return reject(result)
            }
            return resolve(result)
          })
        })
      }
      async function handler(req, res) {
        await runMiddleware(req, res, (req, res, fn) => {
        	
        })
      	
        res.json({})
      }
      export default handler

      Javascript language logo
      your recipe card header background
      Next API with middleware

      next
      api
      middleware
      NextJS Javascript Recipes

      Next API with middleware

      Shortcut: next.api.middleware.create

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.