server startup refactoring, and mocha unit test framework