kubrick
v0.1.5
Published
A full featured NodeJS redirect server. Can be used stand-alone or with Express or Koa with the provided middleware methods.
Downloads
3
Maintainers
Readme
Kubrick
A standalone NodeJS redirect server. Middleware planned for Express and Koa. This should be considered a work-in-progress.
Usage
Standalone
Pass the constructor a string containing a fallback URL and bind to a port
kubrick('http://kubrickjs.com').listen(80);
Pass an array of redirect objects to the constructor and bind to a port
kubrick('http://kubrickjs.com', [
{
pattern : '/',
target : '/home'
}, {
pattern : '/old',
target : '/new'
}
]).listen(80);
Pass an object to the constructor with optional fallback and array of redirects then bind to a port
kubrick({
fallback : 'http://kubrickjs.com',
redirects : [
{
pattern : '/',
target : '/home'
}, {
pattern : '/old',
target : '/new'
}
]
}).listen(80);
Pass an object to the constructor with optional fallback and array of redirects then bind to a port
kubrick({
fallback : 'http://kubrickjs.com',
hosts : {
'localhost' : [
{
pattern : '/',
target : '/home'
}, {
pattern : '/old',
target : '/new'
}
],
'www.google.com' : [
{
pattern : '/',
target : 'http://google.com'
}, {
pattern : '/old',
target : '/new'
}
]
}
}).listen(80);
Releases
0.1 - Initial version
- Constructor
- Load
- Listen method
- Static redirects
Roadmap
0.2 - Tests
0.3 - Strict redirects, Wildcard redirects
0.4 - Listen securely
0.5 - Regex redirects, Internal redirects
0.6 - Express & Koa middleware
0.7 - Middleware prefix
0.8 - Koa middleware
0.9 - Fixes
1.0 - Gold
Tests
Make sure you have the mocha testing framework installed globally
$ npm install -g mocha
Then run mocha:
$ mocha