node.js - API design - splitting into different sub-domains (micro-services) -
our application based on api first architecture , based on single domain / service:
api.todos.com
consumers of api :
- our web-frontend
- our mobile-apps
- other business / public
we building new micro-services written in different languages same application. example might develop api services for:
- statistics
- blog / content
- rss feed
- search
my question around dealing domains. best split each service different subdomain e.g.
api.todos.com
stats.todos.com
content.todos.com
rss.todos.com
search.todos.com
or better have single unified api domain http (layer 7) routing 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 preferable public api? easier have multiple sub-domains , not have deal intermediate routing layer / proxy.
as system architect think it better have single unified api domain http (layer 7) routing reach our endpoints
. can make system more flexible without changes clients. example have microservice routes:
- api.todos.com/route1
- api.todos.com/route2
in future can split microservice routes.
but mostly, depends on api gateway use. api gateway single entry point in system, proxy request correct microservice. make auth , cache. more microservice's pattern can read here.
Comments
Post a Comment