Files
elysia-swagger/example/index.ts
2024-10-03 10:01:58 +07:00

42 lines
1.2 KiB
TypeScript

import { Elysia } from 'elysia'
import { swagger } from '../src/index'
const app = new Elysia()
.use(
swagger({
provider: 'scalar',
documentation: {
info: {
title: 'Elysia Scalar',
version: '0.8.1'
},
tags: [
{
name: 'Test',
description: 'Hello'
}
],
components: {
schemas: {
User: {
description: 'string'
}
},
securitySchemes: {
JwtAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
description: 'Enter JWT Bearer token **_only_**'
}
}
}
},
swaggerOptions: {
persistAuthorization: true
}
})
)
.get('/id/:id?', 'a')
.listen(3000)