Nebulous Puffy Marshmallows
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    derequestpublic

    Derequest

    De-request could help you forward a request to a list of local files. It is a simple proxy for Connect which works on top of dispatch.

    Use it before dispatch with connect like:

    var path = require('path')
    ,	connect = require('connect')
    ,	dispatch = require('dispatch')
    ,	derequest = require('derequest');
    
    var _derequestVars = {
    	'/javascript/bundled_js.version.js':[
    		path.join(__dirname, 'javascript', 'first.js'),
    		path.join(__dirname, 'javascript', 'second.js'),
    		path.join(__dirname, 'javascript', 'third.js')
    	],
    	'/styles/bundled_css.version.css':[
    		path.join(__dirname, 'styles', 'first.css'),
    		path.join(__dirname, 'styles', 'second.css'),
    		path.join(__dirname, 'styles', 'third.css')
    	]
    };
    
    var _dispatchVars = {
    	'url_pattern_1':function(req, res, next){ ... },
    	'url_pattern_2':function(req, res, next){ ... }
    };
    
    connect.createServer()
    	.use(derequest(_derequestVars)))
    	.use(dispatch(_dispatchVars))
    	.listen(8080);
    

    Keywords

    none

    install

    npm i derequest

    Downloadsweekly downloads

    4

    version

    0.0.1

    license

    none

    last publish

    collaborators

    • avatar