
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
biscuitsjar
Advanced tools
A minimal and high-performance Node.js framework with advanced routing, validation, middleware, and error handling.
Biscuit is a lightweight and flexible HTTP server framework for Node.js, built to provide a robust Hook system for managing request flow, authentication, error handling, and middleware execution. It includes a custom router and advanced hook management, making it highly customizable and extensible.
AbortController.GET, POST, PUT, DELETE, PATCH methods./api/user/:id).npm install biscuitsjar
const Biscuit = require('./Biscuit');
const app = new Biscuit();
app.route('GET', '/api/hello', async (req, res) => {
res.send({ message: 'Hello, World!' });
});
app.route('POST', '/api/data', async (req, res) => {
res.send({ message: 'Data received' }, 201);
});
Biscuit's hook system allows attaching custom behavior to different parts of the request lifecycle.
Executed when a request is received.
app.hook.atReq('/api/data', async (req, res) => {
console.log('Processing request:', req.url);
}, { priority: 50 });
Executed before sending the response.
app.hook.atRes('/api/data', async (req, res) => {
console.log('Finalizing response for:', req.url);
});
Executed before route processing to enforce authentication.
app.hook.atAuth('/secure', async (req, res) => {
if (!req.headers.authorization) {
throw new Error('Unauthorized');
}
});
Executed after the route handler.
app.hook.atRoute('/api/users', async (req, res) => {
console.log('Route logic executed');
});
Executed when an error occurs.
app.hook.atErr('/api/data', async (req, res) => {
console.error('Handling error for:', req.url);
});
Executed when a specific HTTP status is set.
app.hook.atStatus(404, async (req, res) => {
console.warn('Handling 404 error.');
});
Define pre-processing and post-processing hooks for more granular control.
app.hook.preHook('atReq', '/api/data', async (req, res) => {
console.log('Pre-processing request...');
});
app.hook.postHook('atReq', '/api/data', async (req, res) => {
console.log('Post-processing request...');
});
Hooks can be removed dynamically.
app.hook.removeHook('atReq', '/api/data', someFunction);
Biscuit provides an event system for handling errors and debugging.
app.hook.on('error', (err) => {
console.error('Hook Error:', err);
});
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});
Detailed Explanation of Biscuit Components
The Hook system in Biscuit allows developers to attach middleware-like functions at different request lifecycle stages.
Each hook has:
Function (fn): The function to execute.
Lifetime (lifetime): How long the hook remains active.
Execution Limit (maxExecutions): Maximum times it can be executed.
Condition (condition): A function that must return true for execution.
Priority (priority): Determines execution order.
Biscuit's Router is designed to handle: 🍪: Static Routes (/api/users) 🍪: Dynamic Routes (/api/user/:id) 🍪:Method-Specific Routes (GET, POST, etc.) 🍪:Query Parameters & URL Parsing
app.route('GET', '/api/user/:id', async (req, res) => {
res.send({ userId: req.params.id });
});
Biscuit provides enhanced response handling: 🍪 Automatic JSON Serialization 🍪:Streaming Support for large data 🍪:Custom Status Codes & Status-Based Hooks
res.send({ message: "Success" }, 200);
For large datasets, use streaming instead of sending entire data at once.
const fs = require('fs');
app.route('GET', '/download', (req, res) => {
const fileStream = fs.createReadStream('largefile.txt');
res.send(fileStream);
});
Example of a global request logger:
app.hook.atReq(async (req, res) => {
console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`);
});
To ensure proper cleanup when the server shuts down:
process.on('SIGTERM', () => {
console.log("Shutting down server...");
app.server.close(() => {
console.log("Server closed.");
});
});
Biscuit is designed to be lightweight, flexible, and highly customizable. The powerful Hook system allows developers to modify request flow, add authentication, handle errors, and customize routing seamlessly.
This README is now in a fully formatted Markdown structure. Let me know if you need any modifications or additions!
FAQs
A minimal and high-performance Node.js framework with advanced routing, validation, middleware, and error handling.
We found that biscuitsjar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.