Most of us have gone through tough times where you have a large-scale application that has a bunch of features, API integrations, database connections, etc. New features and updates get released, and of course, you need to fix the bugs and maintain the code.

Building this real-world application requires dynamic programming, where the size of the application grows uncontrollably.

This monolith pattern becomes very hard to downsize or simplify the application. So to run the app smoothly, it is essential to convert the large, homogeneous structure into small, independent pieces of programs. Similar complexities can be resolved effortlessly when the NodeJs applications are built on **microservices, **more so with the Node.js ecosystem.

So I am going to show you how to build microservices…

This blog is only for an overview of how to build the services, please visit https://github.com/Nomercy10/ecommerce-micro-services for a full functional working microservices demo.

In our example, we will be building two microservices, **_Users & Orders. _**The idea is very simple, users will place an order. We create the order with all the required details, and so on.

Here is the list of the features each of these microservice will have

Users

  • GET all users
  • GET user
  • Create new user
  • DEL user by userId

Orders

  • GET all orders
  • GET order
  • GET orders for a user
  • Create a new order for a user
  • DEL an order
  • DEL orders for a user

Tech

  • Node.js : evented I/O for the backend
  • Express : Fast node.js network app framework
  • MongoDb : A NoSql database for modern applications

As we build these microservices we will create separate folders for each microservice. Each folder will have its own package.json and node modules installed.

Let’s get started…

#nodejs #expressjs #mongodb #node

Basic Guide To Building Microservices With MongoDB, NodeJs, And Express
2.35 GEEK