Our application is based on an API first architecture and is currently based on a single domain / service:
api.todos.com
Consumers of the API are :
- Our web-frontend
- Our mobile-apps
- Other business / public
We will be building new micro-services written in different languages for the same application. For example we might develop API services for:
- Statistics
- Blog / Content
- RSS Feed
- Search
My question is around dealing with domains. Would it be best to split each service into a different subdomain e.g.
api.todos.com
stats.todos.com
content.todos.com
rss.todos.com
search.todos.com
Or is it better to have a single unified API domain where we do HTTP (layer 7) routing to reach our endpoints. e.g.
api.todos.com/todos
api.todos.com/stats
api.todos.com/content
api.todos.com/rss
api.todos.com/search
Not sure which is preferable for a public API? It would be easier to have multiple sub-domains and not have to deal with an intermediate routing layer / proxy.