3 ms·
Ask HN: What are the components needed to make a web API?
Let's say if I want to make a web API (in java?) which integrates with a website (or mobile application), what are the components required for that.
In my knowledge following things will be required (please correct and add things):
- A web server which will be sending requests to my Java process. (like Nginx? or Jetty?)
- I will need a load balancer/ELB (Nginx also can be used as an LB, right?)
Where would I be needing Jetty? And if I am using Jetty, do I still need to use Nginx? I have heard people using Jetty and Nginx together; what are the purpose both solving in those cases?
And if this web API needs to communicate other APIs (how can I make them interact with each other- I can probably use REST APIs, right?). If I am right, this is called discovering APIs. What are they different ways to achieve this?
As you can guess, I have limited knowledge in this area (designing them at an architecture level, them discovering each other and integrating them to be used via the Web or other clients). Please try to fill the gap as much as possible.
Thanks in advance!
- moondev 11y agoIt depends on how you develop your application. If you are building a war you need to serve it with a java application server like tomcat, jetty etc. Some frameworks like spring boot can build an "uber jar" which is basically like a batteries included executable. You just run it with java -jar directly and it begins taking requests. nginx is generally used as a proxy and load balancer. I would reccomend you use an ELB if you are on aws though. The basic idea is that you setup your application server to auto-start on launch. Bake your instance into an ami (amazon machine image), Then you can create an auto-scaling group using that ami and attach an elb to it. As long as your java application is stateless it will work like a charm.