16 lines
299 B
TypeScript
16 lines
299 B
TypeScript
import { Elysia } from 'elysia'
|
|
|
|
const prettyJson = new Elysia()
|
|
.mapResponse(({ response }) => {
|
|
if (response instanceof Object)
|
|
return new Response(JSON.stringify(response, null, 4))
|
|
})
|
|
.as('scoped')
|
|
|
|
new Elysia()
|
|
.use(prettyJson)
|
|
.get('/', () => ({
|
|
hello: 'world'
|
|
}))
|
|
.listen(3000)
|