0.0.2 • Published 8 months ago

bunzer v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Bunzer - the fastest javascript server

25x faster than Express based on this benchmark

FrameworkAverageGet (/)Params, query & headerPost JSON
bunzer (bun)285,762.363342,871.54260,395.69254,019.86
uws (node)278,776.167322,555.4295,197.79218,575.31
stricjs (bun)216,630.463245,057.11207,736.29197,097.99
elysia (bun)214,890.317251,968.29202,802.69189,899.97
bun (bun)213,534.33249,512.44196,581.78194,508.77
vixeny (bun)208,969.307238,919.74200,920.93187,067.25
hono (bun)201,313.597232,681.33203,405.59167,853.87
bun-web-standard (bun)195,904.55216,791.66194,000.6176,921.39
nhttp (bun)191,891.073241,789.94181,050.04152,833.24
hyper-express (node)184,534.003268,293.51210,629.174,679.4
hyperbun (bun)146,633.573192,520.17147,533.4999,847.06
baojs (bun)136,181.91171,221.71132,735.77104,588.25
nbit (bun)135,690.673173,464.2132,190.21101,417.61
hono (deno)118,515.623145,397.44126,152.8983,996.54
h3 (node)94,372.367105,242.8992,487.0685,387.15
fast (deno)78,733.58390,591.2479,986.0665,623.45
fastify (node)56,487.1264,370.559,750.5445,340.32
oak (deno)43,052.53750,180.0345,907.4633,070.12
abc (deno)36,408.97344,033.8338,891.6826,301.41
koa (node)35,385.21739,107.2937,100.9429,947.42
hapi (node)22,709.92732,911.7912,654.8922,563.1
hono (node)13,911.71714,163.8916,205.5111,365.75
express (node)13,799.19713,830.715,729.4211,837.47
nest (node)12,378.50712,913.4613,642.9310,579.13
acorn (deno)8,675.51314,187.876,607.045,231.63

Documentation / Usage Example

import {serve, get, post, response} from 'bunzer'

get('/hello',       req => 'Hello, World!')
get('/json',        req => ({hello: 'world'}))
get('/hello/:name', req => `Hello, ${req.params.name}!`)
get('/status',      req => response(`I'm a teapot`, {status: 418}))
get('/contenttype', req => response(`{"a": 1}`, {content_type: 'application/json'}))
get('/setheaders',  req => response(`brrrr`, {headers: {'X-Powered-By': 'bunzer'}}))
get('/getheaders',  req => req.headers['user-agent'])
get('/ip',          req => req.ip)
get('/query',       req => req.query.limit) // /query?limit=10
get('/error',       req => null.ptr)
get('/async', async req => (await fetch('https://example.com')).text())

post('/body', req => {
  const {username, message} = JSON.parse(req.body)
})

serve({hostname: 'localhost', port: 8080, public_folder: 'public'})
0.0.2

8 months ago

0.0.1

8 months ago

0.0.0

8 months ago