I am trying to export function within route file. Here is my code in user.js
var express = require('express');
var router = express.Router();
router.post("/test", function (req, res, next) { res.send("success");
});
var funDef=function(){
console.log("export a function")
}
moudle.exports=router;
How can I export or call funDef in another js file. I tried the following way but it is not working
var readFun= require("./user.js");
readFun.funDef();
Can anyone guide me?