Refactor the API and express server setup.