0.2.1 • Published 6 years ago

fastify-dns-prefetch-control v0.2.1

Weekly downloads
16
License
MIT
Repository
github
Last release
6 years ago

fastify-dns-prefetch-control

Build Status Code coverage Code style Dependency Status Dev Dependency Status NPM version NPM downloads NPM license

Fastify plugin to set X-DNS-Prefetch-Control header

Why?

You may know dns-prefetch-control as a dns-prefetch-control middleware used in helmet. And you could use it as a middleware in fastify also. So why i made this plugin?

You may find the reason in benchmark result and wish you like it. :)

Install

Via npm:

npm i fastify-dns-prefetch-control

Via yarn:

yarn add fastify-dns-prefetch-control

Usage

const fastify = require('fastify');
const fastifyDnsPrefetchControl = require('fastify-dns-prefetch-control');

const app = fastify();
app.register(fastifyDnsPrefetchControl);

app.listen(3000, err => {
  if (err) throw err;
});

Options

This plugin has the same options as the middleware in helmet.

allow {boolean}

Set X-DNS-Prefetch-Control to on if it's a truly value and off for a falsely value. Default is false.

Changelog

  • 0.2.0
    • Add test case
    • Add code coverage
    • Add benchmarks
  • 0.1.0:
    • Init version