Skip to content

Commit 37d34ec

Browse files
docs(express): split pingExpress into v1 and v2
TICKET: WCI-188
1 parent d067420 commit 37d34ec

4 files changed

Lines changed: 38 additions & 10 deletions

File tree

modules/express/src/clientRoutes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function handlePing(
8383
return req.bitgo.ping();
8484
}
8585

86-
function handlePingExpress(req: ExpressApiRouteRequest<'express.pingExpress', 'get'>) {
86+
function handlePingExpress(req: ExpressApiRouteRequest<'express.ping', 'get'>) {
8787
return {
8888
status: 'express server is ok!',
8989
};
@@ -1695,7 +1695,8 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {
16951695
app.use(router);
16961696

16971697
router.get('express.ping', [prepareBitGo(config), typedPromiseWrapper(handlePing)]);
1698-
router.get('express.pingExpress', [typedPromiseWrapper(handlePingExpress)]);
1698+
router.get('express.v1.ping', [typedPromiseWrapper(handlePingExpress)]);
1699+
router.get('express.ping', [typedPromiseWrapper(handlePingExpress)]);
16991700

17001701
// auth
17011702
router.post('express.login', [prepareBitGo(config), typedPromiseWrapper(handleLogin)]);

modules/express/src/typedRoutes/api/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { apiSpec } from '@api-ts/io-ts-http';
33
import * as express from 'express';
44

55
import { GetPing } from './common/ping';
6-
import { GetPingExpress } from './common/pingExpress';
6+
import { GetV1PingExpress } from './v1/pingExpress';
7+
import { GetV2PingExpress } from './v2/pingExpress';
78
import { PostLogin } from './common/login';
89
import { PostDecrypt } from './common/decrypt';
910
import { PostEncrypt } from './common/encrypt';
@@ -69,8 +70,11 @@ export const ExpressPingApiSpec = apiSpec({
6970
});
7071

7172
export const ExpressPingExpressApiSpec = apiSpec({
72-
'express.pingExpress': {
73-
get: GetPingExpress,
73+
'express.v1.ping': {
74+
get: GetV1PingExpress,
75+
},
76+
'express.ping': {
77+
get: GetV2PingExpress,
7478
},
7579
});
7680

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as t from 'io-ts';
2+
import { httpRoute, httpRequest } from '@api-ts/io-ts-http';
3+
import { BitgoExpressError } from '../../schemas/error';
4+
5+
/**
6+
* Ping Express (v1)
7+
*
8+
* Ping bitgo express to ensure that it is still running. Unlike /ping, this does not try connecting to bitgo.com.
9+
*
10+
* @operationId express.v1.ping
11+
* @tag Express
12+
*/
13+
export const GetV1PingExpress = httpRoute({
14+
path: '/api/v1/pingexpress',
15+
method: 'GET',
16+
request: httpRequest({}),
17+
response: {
18+
200: t.type({ status: t.string }),
19+
404: BitgoExpressError,
20+
},
21+
});

modules/express/src/typedRoutes/api/common/pingExpress.ts renamed to modules/express/src/typedRoutes/api/v2/pingExpress.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import { httpRoute, httpRequest } from '@api-ts/io-ts-http';
33
import { BitgoExpressError } from '../../schemas/error';
44

55
/**
6-
* Ping Express
6+
* Ping BitGo Express
77
*
8-
* @operationId express.pingExpress
9-
* @tag express
8+
* Ping bitgo express to ensure that it is still running. Unlike /ping, this does not try connecting to bitgo.com.
9+
*
10+
* @operationId express.ping
11+
* @tag Express
1012
*/
11-
export const GetPingExpress = httpRoute({
12-
path: '/api/v[12]/pingexpress',
13+
export const GetV2PingExpress = httpRoute({
14+
path: '/api/v2/pingexpress',
1315
method: 'GET',
1416
request: httpRequest({}),
1517
response: {

0 commit comments

Comments
 (0)