-
Notifications
You must be signed in to change notification settings - Fork 0
/
tech-def.txt
58 lines (54 loc) · 3.8 KB
/
tech-def.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Morgan:
sets up middleware in an Express.js application to log HTTP requests and responses
Purpose
> Debugging: It allows developers to see incoming requests and their details in real-time.
> Monitoring: Developers can monitor the performance and status of requests.
> Auditing: Logs can be useful for auditing purposes, understanding usage patterns, and identifying issues.
----------------------------------------------------------
Passport.js:
passport.session():
Session Middleware: passport.session() is middleware. Passport allows features like login with GitHub or google
----------------------------------------------------------
URLencoded: forms data and populates req.body with this data. The extended: false option uses the querystring library for parsing, suitable for simple key-value pairs. This setup is crucial for handling form submissions in web applications.
front end:
<form action="/submit" method="post">
<input type="text" name="username" value="john">
<input type="text" name="email" value="[email protected]">
<button type="submit">Submit</button>
</form>
Backend:
app.use(express.urlencoded({ extended: false }));
app.post('/submit', (req, res) => {
console.log(req.body); // This will log: { username: 'john', email: '[email protected]' }
res.send('Form data received');
});
----------------------------------------------------------
Swagger UI
Swagger UI is a tool that automatically generates interactive API documentation. It reads the API specifications and allows users to explore and test the API endpoints directly from a web interface.
serve Middleware
serve is a middleware function provided by swagger-ui-express that serves the static files required for the Swagger UI interface. It sets up the necessary routes to serve these files.
setup Middleware
setup is another middleware function provided by swagger-ui-express that configures Swagger UI with your API documentation.
It takes the Swagger documentation object (swaggerJsDocs) and sets up the UI to display the API documentation based on this object
----------------------------------------------------------
A Redis adapter uses Redis as a message broker to share event information between different server instances.
Redis is an in-memory data structure store that can act as a message broker, providing a publish/subscribe mechanism.
Initialization:
The Redis adapter is initialized with the given host and port configuration. This tells Socket.IO to use Redis for managing communication between multiple server instances.
Communication:
When a client emits an event, the event is sent to the server instance the client is connected to.
If the server needs to broadcast this event to clients connected to other server instances, the Redis adapter publishes the event to the Redis server.
Other server instances subscribed to this event channel receive the event and can then emit it to their connected clients.
a message sent from a client connected to Server A would only be received by other clients connected to Server A. Clients connected to Server B or Server C would not receive the message.
With the Redis adapter, the flow works as follows:
Client 1 (connected to Server A) sends a message.
Server A receives the message and publishes it to the Redis server.
The Redis server broadcasts the message to Server B and Server C.
Server B and Server C emit the message to their connected clients.
Clients connected to Server B and Server C receive the message.
server means each ec2 machine on which our backend is running
----------------------------------------------------------
Node Piston: Piston is a high performance general purpose code execution engine. It excels at running untrusted and possibly malicious code without fear from any harmful effects
Used in code sandbox
-----------------------------------------------------------
Monaco-editor is used for code sandbox