I have this API handler
pages/api/[slug]/[uid].ts
I want to rewrite the requests to the root of my app, to: http://localhost:3000/[slug]/[uid]
What I need to do on next.config to achieve this?
Found the solution is
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
async rewrites() {
return [
{
source: '/:slug/:uid',
destination: '/api/:slug/:uid',
},
]
},
}