
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
better-fastify-405
Advanced tools
A simple and fully customizable Fastify plugin for handling 405 gracefully.
By default Fastify suppress error 405 and with return 404 instead. A 405 error would improve the development experience.
fastify-405 was built to solve this issue, but it requires you to input a RegExp for the route you want to handle 405.
This plugin is meant to read from your current route setting, and create routes that return 405 automatically.
npm add better-fastify-405
yarn add better-fastify-405
//app.js
import fastify, { FastifyRequest, FastifyReply, FastifyInstance, HookHandlerDoneFunction, RouteOptions } from 'fastify';
const app: FastifyInstance = fastify({
logger: true
})
//Other plugins
app.register(import("fastify-etag"))
app.register(import('plugins/better-fastify-405'), {
routes: [
//Required.
//Register all your route here, or else this plugin would not work.
import('./routes/index'),
import('./routes/protected')
//All the route will be registered inside the plugin. Do not use app.register() here.
],
filterCallback: ({ route, method }) => {
// Optional
// A callback to allow you filter out specific route and specific method from assigning it to 405
//Route: route registered
//Method: method available to apply 405
return true
}
})
OPTIONS
route with 405A function allowCORS
is provided to help you not mark OPTIONS
for 405.
import better405, { allowCORS } from 'better-fastify-405'
import fastify, { FastifyRequest, FastifyReply, FastifyInstance, HookHandlerDoneFunction, RouteOptions } from 'fastify';
const app: FastifyInstance = fastify({
logger: true
})
//Other plugins
app.register(import("fastify-etag"))
app.register(better405, {
routes: [
import('./routes/index'),
import('./routes/protected')
],
filterCallback: allowCORS
})
FAQs
A better plugin for handling 405 in Fastify
The npm package better-fastify-405 receives a total of 1 weekly downloads. As such, better-fastify-405 popularity was classified as not popular.
We found that better-fastify-405 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.