Taxum / @taxum/core / server / serve
Function: serve()
serve(
service
,config?
):Promise
<void
>
Defined in: server/index.ts:93
Serve any service via HTTP.
This method of running a service is intentionally simple and only supports the minimally required configuration. If you need to support HTTPS and/or HTTP2, you should create your own listener. In most cases this should not be required, as TLS termination and HTTP2 are usually handled by a reverse proxy in production.
Parameters
service
config?
Returns
Promise
<void
>
Example
ts
const router = new Router()
.route("/", get(() => HttpResponse.builder().raw("Hello world!"));
await serve(router, {
port: 8080,
catchCtrlC: true,
shutdownTimeout: 3000,
});