Untitled

When using exports.router wala line - I'm getting an error. No error with module.exports - Why?
mail@pastecode.io avatar
unknown
javascript
a year ago
527 B
0
Indexable
Never
// Admin.js file
const express = require('express');
const router = express.Router();

const adminController = require('../controllers/admin');

// /admin/add-product => GET
router.get('/add-product', adminController.getAddProduct);

// /admin/products => GET
router.get('/products');

// /admin/add-product => POST
router.post('/add-product', adminController.postAddProduct);

module.exports = router;
// exports.router = router;

// App.js file
const adminRoutes = require('./routes/admin');

app.use('/admin', adminRoutes);