Skip to content

jpeiter/nestjs-systeminfo

Repository files navigation

nestjs-systeminfo

Simple HTTP/WebSocket interface created with NestJS, socket.io and systeminformation, that provides information about the server/pc it is running on.

Installation

$ npm install

Running the app

$ npm run start

HTTP

To make an HTTP request, all you've got to do is send a GET request to:

http://localhost:3000/system/info?type={TYPE}

Where the query parameter type has to be one of the following options: CPU, CPU_SPEED, CPU_TEMPERATURE, DISK, GPU, OS, or RAM.

WebSocket

To request and listen to messages via WS, just connect to the port 3000, and emit/listen to the update event. The following code shows an example using socket.io's Client API.

const socket = io('http://localhost:3000');

listen = () => {
  socket.on('update', (data) => {
    console.log('data :', data);
  })
}

emit = (type) => socket.emit('update', { type });

listen();
emit(); // You may decide when to call it

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks