elysia-http-status-code
v1.0.9
Published
Simple http status code plugin for Elysia.js.
Downloads
249
Maintainers
Readme
Elysia Http Status Code
Simple http status code plugin for Elysia.js.
Installation
bun add elysia-http-status-code
Usage
import Elysia from 'elysia'
import { HttpStatusCode } from 'elysia-http-status-code';
new Elysia()
.use(HttpStatusCode())
.get('/'. ({set, httpStatus}) => {
set.status = httpStatus.HTTP_200_OK;
return `Hello With response ${httpStatus.HTTP_200_OK}`;
})
.post('/user', ({set, body, httpStatus}) => {
set.status = httpStatus.HTTP_201_CREATED;
return {"user": body.name}
})
.listen(3000);