How come the image file in my classroom.ejs is not showing if I use this
app.configure(function() {
//app.use('/room1',express.static(__dirname+'/public'));
app.use(express.static(__dirname+'/public'));
app.set('views', __dirname + '/public');
});
app.get('/room1/:nickname', function(req, res){
res.render('classroom.ejs', {title: req.params.nickname});
});
If I uncomment the app.use('/room1',express.static(__dirname+'/public'));
It works.
I need the static files to pull from /public regardless of the route and given the fact that its on top,
it should have top priority. I'm using Express 3.0.x
Can you try this:
var path = require('path');
...
app.use(app.router);
app.use('/', express.static(__dirname + '/public'));