@metreeca/gate - v0.12.0
    Preparing search index...

    Type Alias Server

    HTTP serving extension for Express applications.

    type Server = {
        listen(options: ServerOpts): Promise<void>;
    }
    Index

    Methods

    Methods

    • Serves the application over HTTP.

      Every request is traced in the log with its outcome and duration. Requests that match no route get a bodiless 404. Errors that no route handles are logged, and the client gets a bodiless response: the error status for client errors, 500 otherwise, so that no internal detail of the failure ever reaches the client.

      Once listening, the server runs until the signal is aborted or the process receives SIGINT or SIGTERM.

      Closing refuses new connections at once, and gives the requests in flight the grace period to complete. Repeating the process signal that started the close terminates the process.

      Calls in the native Express form, with no argument, a port, a path or a callback, return the underlying http.Server. Their requests are still traced in the log, but unmatched routes and unhandled errors get the standard Express responses, and closing the server is left to the caller.

      Parameters

      • options: ServerOpts

        The server options; every option may be omitted, and {} applies the defaults

      Returns Promise<void>

      A promise resolving once the server is closed, rejecting if an option is malformed or listening fails