loading...

Discussion on: web / mobile app + API

Collapse
eruizdechavez profile image
Erick Ruiz de Chavez

Going with the subdomains could present some cross domain issues; that being said, there are ways to solve these problems by setting the right CORS headers. I would go first with the path approach and if things get difficult at some point then reorganize them.

Having your API inside /api should not present any problems at all, even if it lives on a different port or even a different server; the way you usually solve this is with a reverse proxy, and it can be done easily on Apache, nginx, or even your favorite language (I would go with Apache/nginx before trying to implement a custom one).

Let's say you have your API running on port 5000, then you instruct your web server to forward anything that starts with /api to port 5000, that way it will be transparent to your API and to your clients.