UNPKG

serx

Version:

A recorder to log incoming requests and monitor memory usage.

54 lines (36 loc) 1.21 kB
# Serx **Version: 1.23.1-premade** **Author: Jeck Christopher Anog** **License: MIT** **Serx** is a lightweight Node.js tool for monitoring and logging server memory usage and real-time incoming connections (IPv4/IPv6). It's built as a plug-and-play helper for servers, especially useful in development or lightweight production environments. --- ## Features - Logs every new incoming connection with IP and protocol family - Periodically displays total connection count - Monitors and displays real-time memory usage (used, free, total) - Clears old logs before printing updated stats to keep the console clean --- ## Installation ```bash npm install serx ``` ## Usage **Basic installation** ```javascript const http = require('http'); const { startSerx } = require('serx'); const server = http.createServer((req, res) => { res.end('Server is being monitored by Serx!'); }); server.listen(3000, () => { console.log('Server running on port 3000'); startSerx(server); // Start Serx monitoring }); ``` **Output Example** ``` Serx: New connection from ::1 (IPv6) [2025-05-05T08:22:13.027Z] Serx: Total connections so far: 5 Memory Usage: 210MB used / 1024MB total Free Memory: 814MB ```