Node.js: Moved API from main.js to api.js