npm.io
2.1.23 • Published 2 months ago

@tinyhttp/jsonp

Licence
MIT
Version
2.1.23
Deps
1
Size
7 kB
Vulns
0
Weekly
0
Stars
2.9K

@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)

Keywords