Skip to content

komputingdao/hermes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hermes Logo
Hermes

A lightweight TCP based message routing framework for Node.js.

✨ Features

  • 🚀 Simple API for defining routes with app.on(route, handler)
  • 🔌 TCP socket-based communication
  • 🛠 Customizable logging
  • 🧹 Clean server lifecycle management (listen, close)
  • 🧪 Easy to test with Node's net module or any TCP client like netcat

📦 Installation

npm install @komputing.xyz/hermes

▶️ Usage

💾 Example Server

import { Hermes } from "@komputing.xyz/hermes";

const app = new Hermes({ port: 8989, logging: true });

app.on("/hello", (data, send) => {
  send(`Hello, ${data || "world"}!`);
});

app.listen();

// Graceful shutdown
process.on("exit", () => app.close());
process.on("SIGINT", () => app.close());
process.on("SIGTERM", () => app.close());

💻 Example Client

import net from "net";

const client = net.createConnection(8989, "127.0.0.1", () => {
  client.write("/hello Alice\n");
});

client.on("data", (data) => {
  console.log("Server response:", data.toString().trim());
  client.end();
});

⌨️ Or via the commandline

netcat 127.0.0.1 8989
/hello Alice

📜 License

MIT

📬 Contact

Komputing - @komputing.xyz - info@komputing.xyz

About

A lightweight TCP based message routing framework for Node.js

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors