UNPKG

@athenna/http

Version:

The Athenna Http server. Built on top of fastify.

26 lines (25 loc) 731 B
/** * @athenna/http * * (c) João Lenon <lenon@athenna.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { ServiceProvider } from '@athenna/ioc'; import { ServerImpl } from '#src/server/ServerImpl'; export class HttpServerProvider extends ServiceProvider { register() { this.container.instance('Athenna/Core/HttpServer', new ServerImpl(Config.get('http.fastify'))); } async shutdown() { const Server = this.container.use('Athenna/Core/HttpServer'); if (!Server) { return; } if (!Server.isListening) { return; } await Server.close(); } }