Integration with Bun
feTS provides you a cross-platform HTTP Server. So you can easily integrate it into any platform besides Node.js. Bun is a modern JavaScript runtime like Node or Deno, and it supports Fetch API as a first class citizen. So the configuration is really simple like any other JS runtime with feTS;
Installation
npm i fets
Usage
The following code is a simple example of how to use feTS with Bun.
import { createRouter, Response } from 'fets'
const router = createRouter().route({
method: 'GET',
path: '/greetings',
schemas: {
responses: {
200: {
type: 'object',
properties: {
message: {
type: 'string'
}
},
required: ['message'],
additionalProperties: false
}
}
},
handler: () => Response.json({ message: 'Hello World!' })
})
const server = Bun.serve(router)
console.info(`Swagger UI is available at http://localhost:${server.port}/docs`)