Zach Zach -4 years ago 119
Node.js Question

Creating NodeJS microservices that are invokable from Android app

For my final year project at uni I've decided to research into micro-services, specifically ones that can be invoked by an Android app.

I want to create a micro-service that queries an API that grabs any new data or changes to existing objects that has been stored. In regards to data storage, I want to try and see if it's possible to either cache the data server-side then feed it to the client-side? Or store that data in a local DB and then read from that to display on the client?

The app itself will be written in Java and the micro-services running/written in a Node environment.

I've done a bit of reading and a lot of people are saying to use RESTful or an API Gateway of sorts.

Any feedback would be greatly appreciated!

Cheers

Answer Source

Creating RESTful web service from NodeJS which is running on your servers or cloud and let the JAVA Android app consumes the services is possible.

Plus: because you're going to make microservice system, so, actually you don't have to worry about your backend's technology since it is one of benefit we got from adopting microservice.

you can have whatever! that provides APIs to your client to consumes services. For examples, you are going to have 4 services. Two of them may use NodeJS, one of them may use Python Flask and another one may use JAVA Spring. Even data storage can be different since if it's microservice it's the best to have their own database.

Anyway, when we talk about microservice, we will think the another different term, so called Monolithic architecture. As you've done the reading, you'd have seen a lot of mention about this style compare with microservice.

I suggest to read books and papers those talked about microservice. Most of them are mentioned about what are the problems of monolithic and why we need to move to microservice. you can find them in https://scholar.google.com/ search for microservice

Martin Fowler gave the definition of microservice as follow:

The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.

and I may refer @rsp's comment:

to have microservices you actually need to have multiple Node applications, each responsible for a fraction of the functionality. Otherwise you have just a service, not microservices.

Thus, for me, microservice is much more about designing a system. the following are the key questions:

  • how do I design my system
  • what are good microservice's principles I selected (you can follow the best practices or develop your own as well)
  • what is the sets of context I got from investigating my application's function (DDD: bounded-context)
  • what are the set of services will be implemented and what context that each service serves
  • when I got the design then I have to think: is it too big or too small
  • how do services communicate with each others
  • etc. (you will also get more questions for yourself while reading materials)

There are more about microservices. I suggest to read

I hope you have fun with your research and building microservice! :D

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download