@itznotabug/appexpress-cors

0.0.2 • Public • Published

AppExpress CORS Middleware

This module allows you to specify cors policy for your Appwrite Functions with AppExpress.

Installation

Add the middleware like this -

npm install @itznotabug/appexpress-cors

Usage

// import
import cors from '@itznotabug/appexpress-cors';
import AppExpress from '@itznotabug/appexpress';

// setup
const express = new AppExpress();

express.middleware(cors({
    origin: '*', // specify an origin or * for all,
    excludes: ['/styles.css'], // exclude cors on some urls, accepts String & Regex,
    preFlightContinue: false, // if false, empty response is sent on `OPTIONS` method,
    optionsSuccessStatus: 204, // status code to be sent on `OPTIONS`,
    methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'], // allowed methods for cors,
}));

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.287latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.287
0.0.11

Package Sidebar

Install

npm i @itznotabug/appexpress-cors

Weekly Downloads

88

Version

0.0.2

License

Apache-2.0

Unpacked Size

7.24 kB

Total Files

3

Last publish

Collaborators

  • itznotabug