Skip to content

Bun-based HTTP framework inspired by 0http

License

Notifications You must be signed in to change notification settings

SaltFish001/0http-bun

 
 

Repository files navigation

Introduction

bun-based HTTP framework fork from 0http

Usage

import http, { IRouter } from '@saltfish/fish-router';

const { router } = http({
  port: 3000,
});
const api_router = new IRouter();

router.use((req, next) => {
  req.ctx = {
    engine: 'bun',
  };

  return next();
});
router.get('/:id', async (req) => {
  return Response.json(req.params);
});
router.post('/', async (req) => {
  return new Response('POST');
});
router.delete('/:id', async (req) => {
  return Response.json(req.params, {
    status: 200,
  });
});
api_router.all('/hello', async () => {
  return new Response('world!');
});
router.use('/api', api_router); // look like /api/hello

export default router;

Support / Donate 💚

You can support the maintenance of this project:

About

Bun-based HTTP framework inspired by 0http

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.8%
  • JavaScript 10.2%