Improved testability of server.js, and implemented start of API test