خرید بک لینک

Vote count: 0

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?

asked 30 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 31 خرداد 1395 ساعت: 18:11

صفحه بندی