Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/express/src/clientRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,7 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {
const router = createExpressRouter();
app.use(router);

router.get('express.v1.ping', [prepareBitGo(config), typedPromiseWrapper(handlePing)]);
router.get('express.ping', [prepareBitGo(config), typedPromiseWrapper(handlePing)]);
router.get('express.pingExpress', [typedPromiseWrapper(handlePingExpress)]);

Expand Down
8 changes: 6 additions & 2 deletions modules/express/src/typedRoutes/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as t from 'io-ts';
import { apiSpec } from '@api-ts/io-ts-http';
import * as express from 'express';

import { GetPing } from './common/ping';
import { GetV1Ping } from './v1/ping';
import { GetV2Ping } from './v2/ping';
import { GetPingExpress } from './common/pingExpress';
import { PostLogin } from './common/login';
import { PostV1Decrypt } from './v1/decrypt';
Expand Down Expand Up @@ -65,8 +66,11 @@ import { GetResourceDelegations } from './v2/resourceDelegations';
// inference stays small; (2) only construct expressApi with a single key and add it to the type union at the end.

export const ExpressPingApiSpec = apiSpec({
'express.v1.ping': {
get: GetV1Ping,
},
'express.ping': {
get: GetPing,
get: GetV2Ping,
},
});

Expand Down
22 changes: 22 additions & 0 deletions modules/express/src/typedRoutes/api/v1/ping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as t from 'io-ts';
import { httpRoute, httpRequest } from '@api-ts/io-ts-http';
import { BitgoExpressError } from '../../schemas/error';

/**
* Ping (v1)
*
* Health check endpoint that returns 200 when the Express server is running.
*
* @operationId express.v1.ping
* @tag Express
* @private
*/
export const GetV1Ping = httpRoute({
path: '/api/v1/ping',
method: 'GET',
request: httpRequest({}),
response: {
200: t.type({}),
404: BitgoExpressError,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import { BitgoExpressError } from '../../schemas/error';
/**
* Ping
*
* Health check endpoint that returns 200 when the Express server is running.
*
* @operationId express.ping
* @tag express
* @tag Express
* @public
*/
export const GetPing = httpRoute({
path: '/api/v[12]/ping',
export const GetV2Ping = httpRoute({
path: '/api/v2/ping',
method: 'GET',
request: httpRequest({}),
response: {
Expand Down
Loading