In this post, we’ll go over how we can use  Nx to create microservices using  Node and  Docker.

We’ll be creating a simple product that will have two applications (a view application, and an API application).

And we will have a Docker container running on http://localhost:8080 that will have two services communicating with each other within the container.

Prerequisites

Since we’re going to be creating images with Docker, it will need to be installed first. You can follow Docker’s install guide at  https://docs.docker.com/desktop

Getting Started

Let’s start by creating a new Nx workspace, run either one of the following:

npx create-nx-workspace --preset=nest

or

yarn create nx-workspace --preset=nest

Then set the following options:

Workspace name (e.g., org name)     my-org
Application name                    api

Next, we’ll add another application. Change directories into the newly created workspace (cd my-org) and run the following command:

npm run nx generate application html

or

yarn nx generate application html

After the html project is created, we’ll add a Node library to share some interfaces between the html and api projects.

#nx #node #microservices

Nx and Node Microservices
5.55 GEEK