Remember that bin/www is a script used to launch the application. It is written as a CommonJS script, but because app.mjs is now an ES6 module, bin/www also must be rewritten as an ES6 module. A CommonJS module cannot, at the time of writing, import an ES6 module.
Change the filename:
$ mv bin/www bin/www.mjs
Then, at the top, change the require statements to import statements:
import app from '../app.mjs';
import DBG from 'debug';
const debug = DBG('notes:server-debug');
const error = DBG('notes:server-error');
import http from 'http';
We've already discussed everything here except that app.mjs exports its app object as the default export. Therefore, we use it as shown here.