epic: full switch to CommonJS

The Koa server ported to new (CommonJS) class files, old files removed,
various clean-ups and enhancements.
Some old code that still needs update is marked with FIXME UPDATE.