API service to stream CPU and Memory (RAM) usage in real-time using WebSocket
- Create a Boiler App
- Add all Routes
- Create Controllers Functions
- Local Storage of Active Streams (partially done, can utilize an in-memory database or db like mongoDB)
- Create a Utils Function to Fetch System Info (used os library, facing issue with native wmic commands)
- Create a Utils Function to Start and Stop Streaming Data through WebSocket
- install npm modules onto root directry
npm install
- To run in development mode
npm run dev
- To run in build mode
npm run build && npm run start
POST /api/create/:type
Parameter | Type | Description |
---|---|---|
type |
string |
Required. Type(cpu/memory) to create stream |
POST /api/start/:id/:type
Parameter | Type | Description |
---|---|---|
id |
string |
Required. Id of stream |
type |
string |
Required. Type(cu/memory) of start stream |
POST /api/stop/:id/:type
Parameter | Type | Description |
---|---|---|
id |
string |
Required. Id of stream |
type |
string |
Required. Type(cu/memory) of stop stream |
POST /api/destroy/:id/:type
Parameter | Type | Description |
---|---|---|
id |
string |
Required. Id of stream |
type |
string |
Required. Type(cu/memory) of destroy stream |