-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AppController with home and ping routes (#50)
* AppController with home and ping routes * Allow Bearer authorization header * Unify unauthorized error message * Fix build error * Fix CI * remove lambda api feature
- Loading branch information
1 parent
ab54f61
commit 840d93b
Showing
38 changed files
with
411 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
|
||
import { AppController } from './app.controller'; | ||
|
||
describe('AppController', () => { | ||
let controller: AppController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [AppController], | ||
}).compile(); | ||
|
||
controller = module.get<AppController>(AppController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
|
||
it('Send ping', () => { | ||
expect(controller.ping()).toBe('pong'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Controller, Get, Redirect, VERSION_NEUTRAL } from '@nestjs/common'; | ||
import { ApiFoundResponse, ApiResponse, ApiTags } from '@nestjs/swagger'; | ||
|
||
@ApiTags('default') | ||
@Controller({ version: [VERSION_NEUTRAL] }) | ||
export class AppController { | ||
@Get('/') | ||
@Redirect('/api', 302) | ||
@ApiFoundResponse({ | ||
description: 'Redirects to the API documentation.', | ||
}) | ||
home() {} | ||
|
||
/** | ||
* # Health check endpoint<br> | ||
* | ||
* This endpoint is a simple health check API designed to confirm that the server is operational. | ||
* | ||
* When accessed, it returns a straightforward response indicating that the service is up and running. | ||
* | ||
*/ | ||
@Get('/ping') | ||
@ApiResponse({ | ||
status: 200, | ||
description: 'Pong', | ||
type: String, | ||
example: 'pong', | ||
}) | ||
ping(): string { | ||
return 'pong'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { PrismaModule } from 'nestjs-prisma'; | ||
|
||
import { AppController } from './app.controller'; | ||
import { AuthModule } from './auth/auth.module'; | ||
import { GroupModule } from './group/group.module'; | ||
import { PingModule } from './ping/ping.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
PrismaModule.forRoot({ isGlobal: true }), | ||
PingModule, | ||
AuthModule, | ||
GroupModule, | ||
], | ||
controllers: [], | ||
imports: [PrismaModule.forRoot({ isGlobal: true }), AuthModule, GroupModule], | ||
controllers: [AppController], | ||
providers: [], | ||
}) | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import client from "@kubb/swagger-client/client"; | ||
import type { ResponseConfig } from "@kubb/swagger-client/client"; | ||
import type { AppHomeQueryResponse } from "../types/AppHome"; | ||
|
||
/** | ||
* @link / | ||
*/ | ||
export async function appHome(options: Partial<Parameters<typeof client>[0]> = {}): Promise<ResponseConfig<AppHomeQueryResponse>["data"]> { | ||
const res = await client<AppHomeQueryResponse>({ method: "get", url: `/`, ...options }); | ||
return res.data; | ||
} |
8 changes: 4 additions & 4 deletions
8
frontend/pek-api/clients/pingSend.ts → frontend/pek-api/clients/appPing.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import client from "@kubb/swagger-client/client"; | ||
import type { ResponseConfig } from "@kubb/swagger-client/client"; | ||
import type { PingSendQueryResponse } from "../types/PingSend"; | ||
import type { AppPingQueryResponse } from "../types/AppPing"; | ||
|
||
/** | ||
* @description # Health check endpoint<br>This endpoint is a simple health check API designed to confirm that the server is operational.When accessed, it returns a straightforward response indicating that the service is up and running. | ||
* @link /api/v4/ping | ||
* @link /ping | ||
*/ | ||
export async function pingSend(options: Partial<Parameters<typeof client>[0]> = {}): Promise<ResponseConfig<PingSendQueryResponse>["data"]> { | ||
const res = await client<PingSendQueryResponse>({ method: "get", url: `/api/v4/ping`, ...options }); | ||
export async function appPing(options: Partial<Parameters<typeof client>[0]> = {}): Promise<ResponseConfig<AppPingQueryResponse>["data"]> { | ||
const res = await client<AppPingQueryResponse>({ method: "get", url: `/ping`, ...options }); | ||
return res.data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.