Refactored request processing out of server.js into api.js with test cases
Refactored request processing out of server.js into api.js with test cases