What is behind this odd issue where express route doesn't work with one route name and does with another?

Viewed 171

I'm experiencing an odd issue where, if I write one route, it redirects to my home page, for reasons beyond me. But if I change even one letter in the route, it all works perfect.

It seems if I write exactly this, with 'entries' in the end, when going to that link, I just get redirected, no matter what the contents of the route. The following does not work (results in immediate redirect, seemingly never accesses the route at all):

router.get('/:username/curatas/:curataId/entries', function(req, res) {
// some code that works.
})

However, when I use absolutely any other choice of letters, it works! Such as omitting the 's' from 'entries' or adding and 'x', etc.

router.get('/:username/curatas/:curataId/entrie', function(req, res) {
// some code that works.
})

What could be the reason for this strange behavior? There's no error I've detected either.

1 Answers

The problem turned out to be cache.

I had never run into this before with any routes and didn't anticipate cache problems with backend code.

So for anyone running into a similar problem, where the current code seems to have no issues, but you're experienced odd, unexpected behavior, with no errors...

Then your problem might be cache. Try it with another browser or clear your cache.

Related