1.0.5 • Published 6 months ago

@types/restify-cors-middleware v1.0.5

Weekly downloads
1,828
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/restify-cors-middleware

Summary

This package contains type definitions for restify-cors-middleware (https://github.com/TabDigital/restify-cors-middleware).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/restify-cors-middleware.

index.d.ts

// Type definitions for restify-cors-middleware 1.0
// Project: https://github.com/TabDigital/restify-cors-middleware
// Definitions by: Daniel Thunell <https://github.com/dthunell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

/// <reference types="node" />

import { RequestHandler } from 'restify';

declare namespace corsMiddleware {
  interface Options {
    /**
     * an array of whitelisted origins
     * can be both strings and regular expressions
     */
    origins: Array<string | RegExp>;
    /** user defined headers to allow */
    allowHeaders: string[];
    /** user defined headers to expose */
    exposeHeaders: string[];
    /** if true, uses creds */
    credentials?: boolean | undefined;
    /** ms to cache preflight requests */
    preflightMaxAge?: number | undefined;
    /** customize preflight request handling */
    preflightStrategy?: any;
  }

  interface CorsMiddleware {
    actual: RequestHandler;
    preflight: RequestHandler;
  }
}

declare function corsMiddleware(options: corsMiddleware.Options): corsMiddleware.CorsMiddleware;
export = corsMiddleware;

Additional Details

Credits

These definitions were written by Daniel Thunell.