• Version 3.4.38
  • Published
  • 5.91 kB
  • 1 dependency
  • MIT license


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


TypeScript definitions for connect



function createServer

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


class IncomingMessage

class IncomingMessage extends http.IncomingMessage {}

    property originalUrl

    originalUrl?: any;


      interface Server

      interface Server extends NodeJS.EventEmitter {}

        property route

        route: string;

          property stack

          stack: ServerStackItem[];

            method handle

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

            method listen

            listen: {
            port: number,
            hostname?: string,
            backlog?: number,
            callback?: Function
            ): http.Server;
            (port: number, hostname?: string, callback?: Function): http.Server;
            (path: string, callback?: Function): http.Server;
            (handle: any, listeningListener?: Function): http.Server;
            • 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.


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