UMS
Section 1: Fundamental Ideas Around Microservices
DONE 20200917
Section 2: A Mini-Microservices App
9. App Overview
10. Project Setup
- make project
- npx cra client
- mkdir posts
- npm init -y
- npm install express cors axios nodemon
- mkdir comments
- same as above
11. Posts Service Creation
WHAT DO YOU WANT YOUR SERVICE TO DO??
- make index.js
- const express = require(‘express 3.
- app.get to posts and app.posts.posts
- app.listen 4000, 90=>
- posts = {}
- randomly generate an id
GOAL: Listening on 4000 for posts
12. Testing the Posts Service
- use postman
body
content-type application/json
13. Implementing a Comments Service
express bodyparser randomBytes appuse bodyparser.jssn()
comments by post ID
14. Quick Comments Test
15. Note on the React App
16. React Project Setup
- Delete all files inside src
- GOAL: “Blog App” display on react app
17. Building Post Submission
- PostCreate
- Add Boostrap CSS CDN to anywhere inside the head
- Add event handler
18. Handling CORS Errors
19. Fetching and Rendering Posts
- make thing
20. Creating Comments
21. Displaying Comments
22. Completed React App
23. Request Minimization Strategies
24. An Async Solution
25. Common Questions Around Async Events
26. Event Bus Overview
27. A Basic Event Bus Implementation
- create new event-bus app
- install express nodemon axios
28. Emitting Events
inside posts make the post request async add axios inside it
await axios.post(our endpoint, our event object)
our event object:
type: ‘PostCreated’, data: {id, title}
29. Emitting Comment Creation Events
type CommentCreated data: { id: commentId, content postId: req.params.id }
30. Receiving Events
31. Creating the Data Query Service
GOAL: We want a single service that connects posts and comments!
- add query
- i express cors nodemon
GOAL 2:
- console log inside query from event bus
- (event bus no more errors)
- console log inside event bus as a response from query`
32. Parsing Incoming Events
33. Using the Query Service
34. Adding a Simple Feature
35. Issues with Comment Filtering
36. A Second Approach
37. How to Handle Resource Updates
38. Creating the Moderation Service
- make boilerplate
- on comment submit send to pending and send to moderation
- on moderation finish, send back to comment
- comment updates to queryservice
- moderation
- axios express nodemon
- index.js
- require statements 5.
39. Adding Comment Moderation
add property ststus: pending add status to comment creation add to query status persist status