separating out init cluster
pulling out server error handler
api server improvments

- adds domain middleware
- takes opts object
- both api and pages now require events
better separation of api and pages