Happy Coding

How to make rest microservice write incoming requests as logs to postgre db?

ok, i want to parse a news website, the sequence is this:

  • restful microservice sits on e.g. “localhost:9000”, it receives a request to parse news . com , the full call is this “localhost:9000/parse/news.com” .
  • that request ‘newscom’ is logged into db
  • rest api starts a kafka task to do parsing
  • parsing is done and results are streamed to apache spark for further analysis
  • analysis results is written to hdfs

i m asking about general way to do this: do i need some front end for the microservice or i can send request just by typing in the address bar “localhost:9000/…”?

I guess I would ask you, what happened when you tried that?

Speaking generally, a REST service is “just” a set of URL endpoints. They’re designed to be used by other code, but there’s nothing stopping you from accessing them in your browser.

For example, here is a simple endpoint that I use:

https://happycoding.io/api/site.json

That URL is used by JavaScript to get data about the site, but you can also visit it in your web browser.

I wrote more about this here: