Replies: 2 comments
-
Hello, I would love to better help, but hard to give good direction without a lot to go on. Based on what you said so far, I can confirm that |
Beta Was this translation helpful? Give feedback.
-
Sorry for long delay (It seemed the answers were blocked). What I tried: const app = express();
const router = express.Router();
router.get('/users/info', function(req, res) {
res.write('info');
res.end();
});
router.get('lists', function(req, res) {
res.end('lists');
});
app.get('/home.html', function(req, res) {
res.send('/home.html');
});
app.all('/users/*', function (req, res, next) {
res.write('/users/');
next();
res.end();
}, router);
app.listen(3000); It worked. You suggested to use When testing router/app.all I expected it avoid to repeat base path but I didn't managed to avoid repetition of
I expected to have |
Beta Was this translation helpful? Give feedback.
-
I come after this:
ef497fd#diff-f7dc29b565d7b8578bbabcd36d010c1eb95527acd5f1395bf3e1a2d4506360c5R425-R437
This seems to be the intended default behavior but in my case I really need namespace. If I let user query /user instead of /user/ path of css are wrong. I know of https://developer.mozilla.org/fr/docs/Web/HTML/Element/base or maybe other way to specify in html. I don't know specific header in http to update this.
I serve content I have no control over (so I can modify on the fly but would like to avoid overhead). I can't imagine a way to use a redirection ? because / in the router match no /. I have enabled strict routing (tried both syntax just in case I did a typo:
app.set('strict routing', true);
andapp.enable('strict routing');
)Beta Was this translation helpful? Give feedback.
All reactions