connect-browser
v0.0.4
Published
A shim for connect in the browser
Downloads
4
Readme
Connect-Browserify
This is a shim for connect for the browser.
Currently it doesn't implement any regex routes. So something like /my/:id
wouldn't work, but normal routes work.
But how does it work on the client, theres no real server??
I'm using domnode-dom streams to pipe directly to document.body
to achieve
the same feel on client/server. That means you can do stuff like:
Example:
var connect = require('connect-browserify');
var app = connect()
app
.use('/', function(req, res, next) {
res.write('root');
res.end();
})
.use('/hello', function(req, res, next) {
res.write('hello');
res.end();
})
.use('/world', function(req, res, next) {
res.write('world');
res.end();
})