Skip to content

thinkkevin/derequest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

Tip: Please use it before dispatch or connect.static.

Installation

npm install derequest

Sample Usage

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);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published