npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fastify-normalize-request-reply

v2.2.1

Published

A Fastify plugin to normalize the request and reply to Express request and response

Downloads

56

Readme

fastify-normalize-request-reply

Build Status Coverage Status Known Vulnerabilities

NOTE

This plugin will not be updated for version Fastify 3.x, because of the internal changes that where made for how middleware is implemented in Fastify now.

NOTE

This plugin does not support Express middleware that goes beyond simple request and response interaction. If the Express middleware has a UI with a template engine view; utilizes the Express routers; or starts its own instance of Express, then it is not supported.

Description

A plugin for Fastify version 2.x that utilizes the Hook onRequest with addHook to normalize the Fastify request and reply to the Express version 4.x request and response. This allows middleware with interaction with the request and response that was originally written for Express to be be utilized within Fastify.

Install

npm install --save fastify-normalize-request-reply

Usage

Add it to you project with register and you are done!

// Register the plugin
fastify.register(require('fastify-normalize-request-reply'));

Options

This plugin allows specifying options that are normally available to the Express request and response through Application Settings:

  • env: String : Environment mode. Be sure to set to production in a production environment. (process.env.NODE_ENV or development, if NODE_ENV environment variable is not set, by default)
  • etag: Varied : Set the ETag response header. For possible values, see the etag options table. (weak by default)
  • json escape: Boolean : Enable escaping JSON responses from the res.json, res.jsonp, and res.send APIs. This will escape the characters <, >, and & as Unicode escape sequences in JSON. (N/A - undefined by default)
  • json replacer: Varied : The replacer argument used by JSON.stringify. (N/A - undefined by default)
  • json spaces: Varied : The space argument used by JSON.stringify. This is typically set to the number of spaces to use to indent prettified JSON. (N/A - undefined by default)
  • jsonp callback name: String : Specifies the default JSONP callback name. (callback by default)
  • query parser: Varied : Disable query parsing by setting the value to false, or set the query parser to use either simple or extended or a custom query string parsing function. (extended by default)
  • subdomain offset: Number : The number of dot-separated parts of the host to remove to access subdomain. (2 by default)
  • trust proxy: Varied : Indicates the server is behind a front-facing proxy, and to use the X-Forwarded-* headers to determine the connection and the IP address of the client. To enable it, use the values described in the trust proxy options table. (false - disabled by default)

License

Licensed under MIT