I am using express-generator to generate the basic routes.
Here is what i have so far in routes
var express = require('express');
var router = express.Router();
var ctrl = require('../controller/index');
var validation = require("../validations/user");
/* GET home page. */
router.route('/').get(ctrl.index);
router.route('/registerUser').post(validation.registerUser,ctrl.registerUser);
It is working fine.
After i add the below routes
router.route('/loginUser').post(validation.loginUser,ctrl.loginUser);
module.exports = router;
i am getting error like
opt/lampp/htdocs/MedApp/node_modules/express/lib/router/route.js:171
throw new Error(msg);
^
Error: Route.post() requires callback functions but got a [object Undefined]
at /opt/lampp/htdocs/MedApp/node_modules/express/lib/router/route.js:171:15
at Array.forEach (native)
How can i allow more routes in the routes.js file ?
Help pls