Q: Does res.send() in an Express JS handler automatically call next()? I understand that one can call next after res.send in an ExpressJS handler, but does res.send 'automagically' call next in any case?  
I have the following code
const express = require('express');

var app = express();

app.get('/', (req, res, next) => {
  console.log('in route handler')
  res.send('Hello World')
});

app.use((req,res, next) => {
  console.log('in middleware')
  console.log('...........')
})

app.listen(process.env.PORT || 8080)

My console log is 
in route handler
in middleware
...........

If I do indeed call next explicitly after res.send I get 
in route handler
in middleware
...........
in middleware
...........

and thus it would seem the middleware is being called twice.
Why is this?  Is it because the middleware is also called 'directly' in some fashion, regardless of the route?  That is, it is simply always called, even when it is after the route handlers?  But I thought if it was after the route handlers, to reach the middleware the route handler preceding it has to call next, as here https://derickbailey.com/2016/05/09/in-what-order-does-my-express-js-middleware-execute/, where it says "It turns out the order in which you add the middleware is important. And since the 2nd 'use' method is added after the 'get' handler, it is never called. The 'get' handler short-circuits the middleware when it renders the page, preventing any further middleware from being processed."
Express version 4.16.0, Node version 11.2.0
Thanks for any clarification!

A: 
Why is this?

It's because browsers send an additional request to get favicon; When you go to localhost:8080 chrome ( or firefox ) sends a get request to / hence your server matches this route and logs: 
in route handler

Immediately after that it sends a second get request to /favicon.ico but your server does not match any route. it continues its way to middlewares mounted after routing and so logs:
in middleware
...........

Of course by calling next() you've called your middleware explicitly after two above request and so:
in route handler
in middleware
...........
in middleware
...........


But I thought if it was after the route handlers, to reach the
  middleware the route handler preceding it has to call next

Of course you are right. Add serve-favicon middleware to your app and your custom middleware never get called without calling next() explicitly unless none of the routes does not get matched:
const express = require('express');
var favicon = require('serve-favicon')
var path = require('path')

var app = express()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

app.get('/', (req, res, next) => {
  console.log('in route handler')
  res.send('Hello World')
});

app.use((req,res, next) => {
  console.log('in middleware')
  console.log('...........')
})

app.listen(process.env.PORT || 8080)

By the way this middleware mounted after all routes is proper place for handling 404's because if we get to this point, none of our apps routes got matched.

A: app.use()
Middleware allows you to have set of actions which your routes should follow. Consider as if all your routes will do some processing before actually performing designated action for that route.
When I ran your code it printed below and Hello World was rendered in both Mozilla(Version 63.0.3 (64-bit)) and Chrome(Version 71.0.3578.80)

in route handler in middleware ...........

res.send()
Now coming to your question, no there is no need to call next() after res.send() is called. Because as soon as it is encountered, it'll send the response immediately. And yes you are correct the order of middleware does matter. So when you added next() after res.send() following actions were performed:


*

*First the '/' route will return Hello World on the browser stop loading

*Your middleware will be called twice, once due to next() and 2nd time due to middleware itself.

