@yolk-oss/elysia-env
v1.0.2
Published
env plugin for Elysia.js
Downloads
964
Readme
@yolk-oss/elysia-env
env plugin for Elysia.js
Installation
bun add @yolk-oss/elysia-env
Usage
import { Elysia, t } from 'elysia'
import { env } from '@yolk-oss/elysia-env'
const app = new Elysia()
.use(
env({
TOKEN: t.String({
minLength: 5,
error: 'TOKEN is required for a service!',
}),
}),
)
.get('/', ({ env }) => env.TOKEN)
// ^? (property) TOKEN: string
.listen(8080)
console.log(`Listening on http://${app.server!.hostname}:${app.server!.port}`)
Checkout the examples and tests folders on github.