Reorder logging and binding in main()

So that this flows a bit more logically. We shouldn't log about listening
on ports until we've started the relevant goroutines. Threads aside.

Also moved and commented the handler for the API server. Because someone new
to Go, like me, can find it hard to see how this method magically binds to
the `http.ListenAndServe` further down.