The Express version is the latest.
This is the app.js file, which is used by another app.js file:
"use strict";
var express = require('express'), engine = require('ejs-locals');
var path = require('path'), map = require('../../app').map;
var register = require('./routes/register').register;
var profile = require('./routes/profile').profile;
var login = require('./routes/login').login;
var app = module.exports = express();
app.configure(function() {
app.engine('ejs', engine);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use('/assets', express.static(path.join(__dirname, 'assets')));
});
app.configure('development', function() {
app.use(express.errorHandler());
});
app.map = map;
app.map(app, {
'/seller': {
'/password': {
get: login.forgot, // Looks in the correct place /assets/css/... etc.
'/forgot': {
get: login.forgot // Looks in wrong place /seller/assets/... etc.
},
'/reset': {
get: login.reset
}
}
}
});
When GET http://localhost:3000/seller/password is requested, Express looks for the static files in the correct location, namely /assets/css/.
But when GET http://localhost:3000/seller/password/forgot is requested, Express looks for the static files in the wrong place, namely /seller/assets/css, which does not even exist.
This is the map function. It is taken from the Express route-map example.
function route_map(app, a, route) {
route = route || '';
for (var key in a) {
switch (typeof a[key]) {
case 'object': // { '/path': { ... }}
app.map(app, a[key], route + key);
break;
case 'function': // get: function(){ ... }
app[key](route, a[key]);
break;
}
}
}
The thing requesting wrong file should be browser, not express, express is a server. So your client side html might be wrong, probably it tries to go ../../assets/css which is correct when your URL is /seller/password/ because it has 2 levels and your css request has 2 up-directories but, when your URL is is /seller/password/forgot it tries to go 2-levels up and it is now at /seller so it appends the /assets/css after that.