fastify-get-only
v1.0.0
Published
Small plugin used in fastify app to make the app only accept GET requests
Maintainers
Readme
fastify-get-only
Supports Fastify versions 3.x
Install
npm i fastify-get-onlyUsage
Require\Import fastify-get-only and register.
// CommonJS
const fastify = require('fastify')();
fastify.register(require('fastify-get-only'), {
httpStatusCode: 400 // Default is 405
errorPayload: {
whateverYouWant: "Method not allowed"
}
});
// ESM
import Fastify from 'fastify';
import FastifyGetOnly from 'fastify-get-only';
fastify.register(FastifyGetOnly, {
httpStatusCode: 400,
errorPayload: {
whateverYouWant: "Method not allowed"
}
})
License
Licensed under MIT.
