mirror of
https://github.com/zoriya/elysia.git
synced 2026-08-15 18:44:25 +00:00
16 lines
299 B
TypeScript
16 lines
299 B
TypeScript
import { Elysia } from '../src'
|
|
|
|
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)
|