Microservice Nodejs Reactjs Part2| Create Multiple Nodejs Service and make communication with it

Опубликовано: 21 Октябрь 2024
на канале: Technophile Firdous
115
6

Github Link : https://github.com/firdousalam/Full-S...
Documents : Service Structure : https://github.com/firdousalam/Full-S...

Complete initial Setup
Step 1 : create react app using
npx create-react-app client
step 2 : Setup Nodejs Posts Service
a. mkdir posts
b. cd posts
c. npm init -y
d. npm install express cors axios nodemon

step 3 : Setup Nodejs Comments Service
a. mkdir Comments
b. cd Comments
c. npm init -y
d. npm install express cors axios nodemon

as per above
for post service we need two URL one to save post and one to retrieve post

Let’s Create the following Path In our Posts Service

Go to Posts Service
create One File (Index.js) and initial Express code
GoTo package.json file
script : nodemon index.js

Let Us Implement Comments Service

so here we will try to add comments based on postId i.e one post may contain multiple comments