A tiny HTTP framework built on Node's native http
module, designed for simplicity and
flexibility in building backend servers and APIs.
import { Cog } from "cog-http";
const app = new Cog();
app.get("/", (_, res) => {
res.set("X-Powered-By", "Cog");
res.send({ message: "Hello from Cog!" });
});
app.listen(3000, "127.0.0.1", () => {
console.log("Listening on 127.0.0.1:3000");
});
-
Ultra lightweight 🪶
- Only 23.5 kB unpacked — one of the smallest HTTP frameworks on npm.
- Minimal abstraction over Node.js native HTTP for maximum performance.
-
Zero runtime dependencies ⚡
- Only relies on Node.js built-in modules.
- No external packages needed to run.
-
TypeScript-ready 🛡️
- Type definitions included.
- Extends native HTTP types with convenient helpers.
-
Easy routing 🛣️
- Simple and intuitive routing API.
- Easy to use and extend.
-
Middleware support 🔄
- Supports middleware functions for request processing.
- Enables modular and reusable logic.
-
Enhanced request & response 📨
- Adds
query
andbody
parsing onIncomingMessage
. - Adds helper methods like
set
andsend
onServerResponse
.
- Adds
Made with:
- Node.js – Core platform.
- TypeScript – For type safety and developer experience.
- Docusaurus – For generating documentation and project website.
- Install:
npm install cog-http
- Create server:
- Import and use the API to define routes, middleware, and handlers.
- Run your server:
- Use Node.js to run your app.
The documentation is available on https://eugsh1.github.io/Cog.
We welcome contributions and appreciate your help in improving Cog.
Please read our Contributing Guidelines before submitting issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.