Kito Framework - v1.0.0-alpha.8
    Preparing search index...

    Class KitoServer<TExtensions>

    Main server class for Kito framework. Extends Router to provide HTTP routing, middleware support, and adds server-specific functionality.

    const app = new KitoServer();

    app.get('/', ctx => {
    ctx.res.send('Hello World!');
    });

    app.listen(3000);

    Type Parameters

    • TExtensions = {}

      Type of custom extensions added to the context

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Methods

    post

    • Starts the server.

      You can call listen in multiple ways:

      1. Using a port (classic usage)

      app.listen(3000);
      app.listen(3000, "0.0.0.0");
      app.listen(3000, () => console.log("Ready"));
      app.listen(3000, "0.0.0.0", () => console.log("Ready"));

      2. Using an options object

      app.listen({
      port: 3000,
      host: "0.0.0.0",
      });

      3. Listening on a Unix Domain Socket

      app.listen({
      unixSocket: "/tmp/kito.sock",
      });

      When unixSocket is provided:

      • port and host are ignored
      • The server binds exclusively to the provided socket path

      You may also pass a callback as the last argument in all forms.

      Parameters

      • OptionalportOrCallbackOrOptions: number | ServerOptions | (() => void)

        Port number, callback, or a full ServerOptions object.

      • OptionalhostOrCallback: string | (() => void)

        Hostname or callback.

      • OptionalmaybeCallback: () => void

        Optional callback executed once the server starts.

      Returns Promise<ServerOptionsCore>

      The resolved server configuration.