E-commerce website App router
Unanswered
niikkhilsharma posted this in #help-forum
import { createEdgeRouter } from 'next-connect';
import dbConnect from '@/backend/config/dbConnect';
import { newProduct } from '@/backend/controllers/productControllers';
const router = createEdgeRouter();
console.log('hii');
dbConnect();
router.post(newProduct);
export async function POST(req, res) {
console.log('api');
return router.run(req);
}in this code the
console.log('hi') is not in the context of the post() method so how making a post request prints hiithis code is from the app/api folder