Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tinyhttp/cors

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/cors

tinyhttp CORS module

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
decreased by-1.71%
Maintainers
1
Weekly downloads
 
Created
Source

@tinyhttp/cors

npm (scoped) npm

A rewrite of cors module.

CORS middleware for HTTP servers.

Install

pnpm i @tinyhttp/cors

API

import { cors } from '@tinyhttp/cors'

Options

host

Host that is allowed to send cross-origin requests. Defaults to '*'.

methods

Allowed methods for performing a cross-origin request. Default ones are ['GET', 'POST', 'PUT', 'PATCH', 'HEAD'] and can be accessed with defaultMethods.

headers

Allowed HTTP headers that can be sent in a cross-origin request. Default ones are ['Origin', 'X-Requested-With', 'Content-Type'] and can be accessed with defaultHeaders.

Example

import { App } from '@tinyhttp/app'
import { cors } from '@tinyhttp/cors'

const app = new App()

app
  .use(
    cors({
      host: 'https://example.com'
    })
  )
  .get('/', (_, res) => void res.end('Hello World'))

License

MIT © v1rtl

Keywords

FAQs

Package last updated on 13 Jul 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc