Move API proxy to api.js