Créez votre propre module de nœud
mycoolmodule/index.js
export.a = "AAAAAA;
exports.hw = function() {
console.log("Hello World!");
}
/*you can exports as many variables and functions as you want*/
routes/index.js
var express = require('express');
var mymodule = require('mycoolmodule')
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
mymodule.hw();
/* console.log(mymodule.a) will yield AAAAAA*/
});
module.exports = router;
Javasper