Skip to content

OneLiL05/fastify-effect-runtime

Repository files navigation

fastify-effect-runtime

Library for integrating effect runtime into fastify

Installation

npm i fastify-effect-runtime
# yarn add fastify-effect-runtime
# pnpm add fastify-effect-runtime

Usage

Register the plugin:

import { Layer } from 'effect'
import fastifyEffectRuntime from 'fastify-effect-runtime'

const app = fastify()

await app.register(fastifyEffectRuntime, {
  layers: Layer.mergeAll(YourFirstLayer, YourSecondLayer)
})

Use effect inside of routes:

import { withEffect } from 'fastify-effect-runtime'

app.get('/health',
  withEffect((_, reply) =>
    Effect.succeed(
      reply.status(200).send({ status: 'ok!' })
    )
  )
)

Contributing

If you want to contribute to improving the project, firstly read CONTRIBUTING.md

Stay in touch

Author - Kyrylo Savieliev

License

fastify-effect-runtime is MIT licensed

About

Library for integrating Effect runtime into Fastify

Topics

Resources

License

Contributing

Stars

Watchers

Forks