@whook/http-server v16.0.0
@whook/http-server
The Whook base HTTP server
The Whook's httpServer
service is
responsible for instanciating the NodeJS HTTP Server and handling its
start/shutdown.
It can be easily replaced by any other HTTP server (an HTTPS one for instance if you cannot use a gateway or a proxy to handle HTTPS connections).
The server takes in charge graceful shutdown by awaiting connections to be
closed before shutting down which can take a long time (basically if a browser
is still maintaining an open socket with it). You can short circuit this
behavior, basically for development, by setting the DESTROY_SOCKETS=1
environment variable.
API
Functions
Typedefs
initHTTPServer(services) ⇒ Promise.<HTTPServer>
Initialize an HTTP server
Kind: global function
Returns: Promise.<HTTPServer> - A promise of an object with a NodeJS HTTP server
in its service
property.
Param | Type | Default | Description |
---|---|---|---|
services | Object | The services the server depends on | |
services.ENV | Object | The process environment variables | |
services.ENV.DESTROY_SOCKETS | String | Whether the server sockets whould be destroyed or if the server should wait while sockets are kept alive | |
services.HTTP_SERVER_OPTIONS | Object | See https://nodejs.org/docs/latest/api/http.html#class-httpserver | |
services.HOST | String | The server host | |
services.PORT | Number | The server port | |
services.httpRouter | function | The function to run with the req/res tuple | |
services.log | function | noop | A logging function |
HTTPServer
Kind: global typedef
Authors
License
2 months ago
3 months ago
9 months ago
7 months ago
6 months ago
9 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago