
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
A simple HTTP routing library built on top of Bun's built in HTTP solution.
bun add hyperbun
import {createServer} from 'hyperbun';
const server = createServer();
server.middleware((request, context) => {
console.log('Just a simple middleware...');
});
server.middleware((request, context) => {
return Error('Oops, I returned a 500.');
});
server.get('/json', (request, context) => {
return {
hello: 'I will automatically become a JSON response...'
}
});
server.get('/text', (request, context) => {
return "Hello, I will be a text/html response...";
});
server.listen({
port: 3000,
hostname: '0.0.0.0'
});
Note, if you consume the request body in your middlewares they will currently be empty in the route handler.
Includes {params: {}, query: {}} by default. More to come.
import {createServer} from 'hyperbun'
const server = createServer();
server.middleware((request, context) => {
context.auth = {user: '1234'};
});
// /home?search=movies
server.get('/home', (_, context) => {
console.log(context.query) // { search: "movies" }
return 'OK';
})
server.get('/private', (_, context) => {
if (context.auth?.user !== '1234') {
// Return your own custom responses too.
return new Response('unauthorized', {
status: 401,
})
}
return {
private: 'data',
}
})
server.listen({port: 3000});
import {createServer} from 'hyperbun';
const server = createServer();
server.post('/users/:userId', async (request, context) => {
const {userId} = context.params;
const updatePayload = await request.json();
await UserModel.updateById(userId, updatePayload);
return { success: "true" };
});
server.listen({
port: 3000,
hostname: "0.0.0.0",
});
import {createServer, asAttachment} from 'hyperbun';
const server = createServer();
server.get('/file', () => {
return Bun.file('./test-file.txt'); // Inline
})
server.get('/file', () => {
return asAttachment('./test-file.txt', { // Attachment (download)
name: 'helloworld.txt'
});
})
server.listen({
port: 3000,
hostname: '0.0.0.0',
});
import {createServer} from 'hyperbun'
const server = createServer();
server.post('/users/add', async (request, context) => {
const user = await request.json();
const result = await database.create(user);
return result;
});
These listeners will automatically match the route and method that you setup and respond with a 404 for ones you don't have.
server.get
server.post
server.put
server.delete
server.patch
FAQs
A fast http framework for Bun runtimes.
The npm package hyperbun receives a total of 1 weekly downloads. As such, hyperbun popularity was classified as not popular.
We found that hyperbun demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.