I'm trying to make a proxy out of the nextjs api, but it seems like it doesn't work.
My pages/api/index.js looks like this:
import { NextApiRequest, NextApiResponse } from 'next';
import httpProxyMiddleware from 'next-http-proxy-middleware';
const API_SERVICE_URL = "https://api.company.io/";
export default (req: NextApiRequest, res: NextApiResponse) => {
console.log('api', req, res)
return httpProxyMiddleware(req, res, {
target: API_SERVICE_URL
})
}
I've the feeling it doesn't reach this, because the log never shows. So, I've moved it to pages/api/[...all]
but this doesn't change anything. Anyone know how to use the Nextjs api to make a proxy?