Express goes through the chain of middleware in the order in which it was added. You have added express.static
as the first middleware, so it will be ran first.
In the event express.static
cannot find a file, it calls next()
, allowing the next bit of middleware to run. This is your handler set up with app.get('/' //...
, which sends the data as you have told it to.