WIP: record progress, re-using mongo connections

This allows websocket and api and everything else to share the same mongo
connection.
use store in server.js
use shared db connection/store everywhere
clean up api a bit
WIP: more refactoring

Work a little bit with storing settings.
clean up server, move requireSSL to middleware

Some simple clean up, hopefully tightening up server.js.