Socket
Socket
Sign inDemoInstall

fastify-jsonp

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fastify-jsonp

A Fastify plugin to add jsonp support


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@pbe/fastify-jsonp

checks js-standard-style

A plugin for Fastify that adds support for jsonp response.

jsonp method in reply is compatible with express

Installation

npm i @pbe/fastify-jsonp

or

yarn add @pbe/fastify-jsonp

Example

const fastify = require('fastify')()

fastify.register(require('@pbe/fastify-jsonp'))

fastify.get('/', (req, reply) => {
  reply.jsonp({ hello: 'world' });
});

fastify.listen({ port: 3000 });

Terminal:

$ curl "http://localhost:3000/?callback=myCallback"
$ /**/ typeof myCallback === 'function' && myCallback({"hello":"world"});

License

MIT License

Keywords

FAQs

Last updated on 29 Oct 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc