@types/connect

  • Version 3.4.35
  • Published
  • 6.14 kB
  • 1 dependency
  • MIT license

Install

npm i @types/connect
yarn add @types/connect
pnpm add @types/connect

Overview

TypeScript definitions for connect

Index

Functions

function createServer

createServer: typeof createServer;
  • Create a new connect server.

Classes

class IncomingMessage

class IncomingMessage extends http.IncomingMessage {}

    property originalUrl

    originalUrl?: any;

      Interfaces

      interface Server

      interface Server extends NodeJS.EventEmitter {}

        property route

        route: string;

          property stack

          stack: ServerStackItem[];

            method handle

            handle: (req: any, res: any, next: Function) => void;
            • Handle server requests, punting them down the middleware stack.

            method listen

            listen: {
            (
            port: number,
            hostname?: string,
            backlog?: number,
            callback?: Function
            ): any;
            (port: number, hostname?: string, callback?: Function): any;
            (path: string, callback?: Function): any;
            (handle: any, listeningListener?: Function): any;
            };
            • Listen for connections.

              This method takes the same arguments as node's http.Server#listen().

              HTTP and HTTPS:

              If you run your application both as HTTP and HTTPS you may wrap them individually, since your Connect "server" is really just a JavaScript Function.

              var connect = require('connect') , http = require('http') , https = require('https');

              var app = connect();

              http.createServer(app).listen(80); https.createServer(options, app).listen(443);

            method use

            use: {
            (fn: NextHandleFunction): Server;
            (fn: HandleFunction): Server;
            (route: string, fn: NextHandleFunction): Server;
            (route: string, fn: HandleFunction): Server;
            };
            • Utilize the given middleware handle to the given route, defaulting to _/_. This "route" is the mount-point for the middleware, when given a value other than _/_ the middleware is only effective when that segment is present in the request's pathname.

              For example if we were to mount a function at _/admin_, it would be invoked on _/admin_, and _/admin/settings_, however it would not be invoked for _/_, or _/posts_.

            call signature

            (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;

              interface ServerStackItem

              interface ServerStackItem {}

                property handle

                handle: ServerHandle;

                  property route

                  route: string;

                    Type Aliases

                    type ErrorHandleFunction

                    type ErrorHandleFunction = (
                    err: any,
                    req: IncomingMessage,
                    res: http.ServerResponse,
                    next: NextFunction
                    ) => void;

                      type HandleFunction

                      type HandleFunction =
                      | SimpleHandleFunction
                      | NextHandleFunction
                      | ErrorHandleFunction;

                        type NextFunction

                        type NextFunction = (err?: any) => void;

                          type NextHandleFunction

                          type NextHandleFunction = (
                          req: IncomingMessage,
                          res: http.ServerResponse,
                          next: NextFunction
                          ) => void;

                            type ServerHandle

                            type ServerHandle = HandleFunction | http.Server;

                              type SimpleHandleFunction

                              type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void;

                                Package Files (1)

                                Dependencies (1)

                                Dev Dependencies (0)

                                No dev dependencies.

                                Peer Dependencies (0)

                                No peer dependencies.

                                Badge

                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/connect.

                                • Markdown
                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/connect)
                                • HTML
                                  <a href="https://www.jsdocs.io/package/@types/connect"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>