Skip to content

suboy/live-require

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

live-require

live require for nodejs module

example

var express = require('express');
var router = express.Router();
var live = function(p){return require('live')(require.resolve(p))};

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/cgi', function(req, res, next) {
	live('./cgi')(req, res);
});

module.exports = router;

when './cgi' file changed, and recive a new request, './cgi' will be reload.

note

live-require module must be disposable .

example, this will not work:

router.get('/cgi', live('./cgi'));

Releases

No releases published

Packages

No packages published