Home / Type/ Server Type — vite Architecture

Server Type — vite Architecture

Architecture documentation for the Server type/interface in connect.d.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  2b00b5b4_9970_c692_f1ea_071b4f091b6f["Server"]
  01fc3a27_ea00_ccfb_3951_3ab12f017e8d["connect.d.ts"]
  2b00b5b4_9970_c692_f1ea_071b4f091b6f -->|defined in| 01fc3a27_ea00_ccfb_3951_3ab12f017e8d
  style 2b00b5b4_9970_c692_f1ea_071b4f091b6f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/types/connect.d.ts lines 47–110

  export interface Server extends NodeJS.EventEmitter {
    (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void

    route: string
    stack: ServerStackItem[]

    /**
     * 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_.
     */
    use(fn: NextHandleFunction): Server
    use(fn: HandleFunction): Server
    use(route: string, fn: NextHandleFunction): Server
    use(route: string, fn: HandleFunction): Server

    /**
     * Handle server requests, punting them down
     * the middleware stack.
     */
    handle(
      req: http.IncomingMessage,
      res: http.ServerResponse,
      next: Function,
    ): void

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

Frequently Asked Questions

What is the Server type?
Server is a type/interface in the vite codebase, defined in packages/vite/src/types/connect.d.ts.
Where is Server defined?
Server is defined in packages/vite/src/types/connect.d.ts at line 47.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free