Skip to content

A mini blog app built using the microservices architecture with several micro services APIs like a moderation service for moderating user comments, posts service, comment service, a query and an event bus for supporting communication between services

Notifications You must be signed in to change notification settings

Ian-Balijawa/mini-micro-services-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Mini-Microservices App

02. Project Setup

$ npm install -g nodemon

$ cd app

$ npx create-react-app client

$ cd app

$ mkdir posts
$ cd posts
$ npm init -y

$ npm install --save express cors axios

$ cd app

$ mkdir comments
$ cd comments
$ npm init -y

$ npm install --save express cors axios

03. Posts Service Creation


$ cd posts
$ npm run start

04. Testing the Posts Service


$ curl \
--request POST http://localhost:4000/posts/ \
--header "Content-Type: application/json" \
| python -m json.tool

$ curl \
--request GET http://localhost:4000/posts/ \
--header "Content-Type: application/json" \
| python -m json.tool

05. Implementing a Comments Service



$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

to solve issue:

[nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch ***
$ cd comments
$ npm run start

06. Quick Comments Test


$ curl \
--data '{"content":"I am a comment"}' \
--header "Content-Type: application/json" \
--request POST http://localhost:4001/posts/123/comments \
| python -m json.tool

$ curl \
--request GET http://localhost:4001/posts/123/comments \
--header "Content-Type: application/json" \
| python -m json.tool

08. React Project Setup



$ cd client

$ npm install --save axios
$ npm start

09. Building Post Submission

10. Handling CORS Errors


11. Fetching and Rendering Posts

12. Creating Comments

13. Displaying Comments

15. Request Minimization Strategies


16. An Async Solution


17. Common Questions Around Async Events


18. Event Bus Overview

19. A Basic Event Bus Implementation

$ cd app
$ mkdir event-bus
$ cd event-bus

$ npm init -y
$ npm install --save express axios

$ npm run start

20. Emitting Events


21. Emitting Comment Creation Events


22. Receiving Events

23. Creating the Data Query Service


$ cd app
$ mkdir query
$ cd query

$ npm init -y
$ npm install --save express cors axios

$ npm run start

24. Parsing Incoming Events


25. Using the Query Service


26. Adding a Simple Feature

27. Issues with Comment Filtering

28. A Second Approach

29. How to Handle Resource Updates

30. Creating the Moderation Service


$ cd app
$ mkdir moderation
$ cd moderation

$ npm init -y
$ npm install --save express axios

$ npm run start

31. Adding Comment Moderation


32. Handling Moderation


33. Updating Comment Content


34. A Quick Test

Comment with text 'orange' has status 'rejected'.


35. Rendering Comments by Status

36. Dealing with Missing Events

37. Implementing Event Sync


38. Event Syncing in Action


About

A mini blog app built using the microservices architecture with several micro services APIs like a moderation service for moderating user comments, posts service, comment service, a query and an event bus for supporting communication between services

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published