fastify-204

5.0.0 • Public • Published

fastify-204

CI npm JavaScript Style Guide

Automatically return 204 status code on empty response.

Install

Yarn

yarn add fastify-204

NPM

npm install fastify-204

Usage

import Fastify from 'fastify'

const fastify = Fastify()

await fastify.register(import('fastify-204'), {
  onUndefined: true,
  onNull: false,
  onEmptyArray: false
})

// This route will reply with a 204 status code
fastify.get('/foo', (req, reply) => {
  reply.send()
})

await fastify.listen({ port: 3000 })

Options

Option Default Description
onUndefined true Return 204 when response is undefined
onNull false Return 204 when response is null
onEmptyArray false Return 204 when response is a empty array ([])

License

Copyright Gilles Marchand, Licensed under MIT.

Readme

Keywords

none

Package Sidebar

Install

npm i fastify-204

Weekly Downloads

5

Version

5.0.0

License

MIT

Unpacked Size

7.9 kB

Total Files

8

Last publish

Collaborators

  • shiva127