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

cors-ts

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cors-ts

Cors package with type definitions

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by42.86%
Maintainers
1
Weekly downloads
 
Created
Source

Cors package with Typescript types

Install

npm install cors-ts

or

yarn add cors-ts

Usage

(see Cors Documentation for more information)

CommonJS
//@ts-check
const express = require('express')
const { cors } = require('cors-ts')

const app = express()
const PORT = process.env.PORT || 4000

//Parameters are Optional
app.use(
  cors({
    origin: '*',
    credentials: true,
  })
)

app.listen(PORT, function () {
  console.log(`CORS-enabled web server listening on port ${PORT}`)
})
ES6
//@ts-check
import express from 'express'
import cors from 'cors-ts'

const app = express()
const PORT = process.env.PORT || 4000

//Parameters are Optional
app.use(
  cors({
    origin: 'http://example.com',
    optionsSuccessStatus: 200,
  })
)

app.listen(PORT, function () {
  console.log(`CORS-enabled web server listening on port ${PORT}`)
})

Credits

Troy Goode (Original Package Creator)

Keywords

FAQs

Package last updated on 30 Apr 2021

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