JSPM

  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q34055F
  • License MIT

JSONP response middleware

Package Exports

  • @tinyhttp/jsonp

Readme

@tinyhttp/jsonp

npm (scoped) npm

JSONP response extension.

Install

pnpm i @tinyhttp/jsonp

Example

import { App, extendMiddleware } from '@tinyhttp/app'
import { jsonp } from '@tinyhttp/jsonp'

new App({
  applyExtensions: (req, res) => {
    extendMiddleware(req, res)
    json(req, res)
  }
})
  .get('/', (req, res) => res.jsonp({ some: 'jsonp' }))
  .listen(3000)