senchalabs/connect — Issue #406: static middleware does not work
Author: akidee
Created: 2011-11-04 17:52:07+00:00
State: open

var router = connect.router(function(app) {
app.get('/', function(req, res, next) {
res.writeHead(200, {
'Content-Type': 'text/html; charset=utf-8'
});
res.write('OK');
return res.end();
});
app.get('/j', function(req, res, next) {
res.writeHead(200, {
'Content-Type': 'text/html; charset=utf-8'
});
res.write('OKJ');
return res.end();
});
return app.get('/js', connect.logger(), connect.static(__dirname + '/static/js', {
maxAge: MAX_AGE * 1000
}));
});
server = this.server = connect.createServer(router);
server.listen(PORT);

The routes for / and /js work, but the files in /js are not served. I want to use the static middleware in different routes so that I can add certain middlewares for different file types etc.