Reputation: 15626
My default router is :
app.get('/', function (req, res) {
console.log("default");
res.send("ok");
});
If I don't have a index.html
in my static directory, the log
and send
will output as will,
but when I add index.html
, the router will direct jump to the page, then I change the name index
to another name, it doesn't jump again.
Why this happen? How can I change this setting things?
Upvotes: 2
Views: 5395
Reputation: 146064
It's your middleware order and configuration that causes this behavior. You presumably are using the static
middleware and by default that happens before the app.router
middleware. The solution is either:
index.html
behaviorapp.user(app.router);
before your static middlewareUpvotes: 5