From b1949ed5079323f6a54391457fefb1755af4a42b Mon Sep 17 00:00:00 2001 From: rkamysz Date: Tue, 25 Jul 2023 09:23:10 +0200 Subject: [PATCH] pass api instance --- src/api/api.ts | 2 +- src/api/start-api.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/api.ts b/src/api/api.ts index 7b80ece..0aede4b 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { ApiConfig } from './api.types'; -export class Api { +export class Api { protected app: WebFramework; constructor(protected config: ApiConfig) {} diff --git a/src/api/start-api.ts b/src/api/start-api.ts index cbea433..3b7bd99 100644 --- a/src/api/start-api.ts +++ b/src/api/start-api.ts @@ -2,11 +2,11 @@ import 'reflect-metadata'; import { Route } from '@alien-worlds/api-core'; import { Api } from './api'; -import { ApiConfig } from './api.types'; - -export const startApi = async (config: ApiConfig, routes: Route[] = []) => { - const api = new Api(config); +export const startApi = async ( + api: Api, + routes: Route[] = [] +) => { routes.forEach(route => { Route.mount(api, route); });