Skip to content

Commit

Permalink
pass api instance
Browse files Browse the repository at this point in the history
  • Loading branch information
rkamysz committed Jul 25, 2023
1 parent e858b5a commit b1949ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { ApiConfig } from './api.types';

export class Api<WebFramework> {
export class Api<WebFramework = unknown> {
protected app: WebFramework;

constructor(protected config: ApiConfig) {}
Expand Down
8 changes: 4 additions & 4 deletions src/api/start-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <WebFramework = unknown>(
api: Api<WebFramework>,
routes: Route[] = []
) => {
routes.forEach(route => {
Route.mount(api, route);
});
Expand Down

0 comments on commit b1949ed

Please sign in to comment.