Skip to content

Commit bf896ac

Browse files
docs(express): split pingExpress into v1 and v2
TICKET: WCI-188
1 parent 4b63462 commit bf896ac

4 files changed

Lines changed: 40 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
};
@@ -1693,7 +1693,8 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {
16931693
app.use(router);
16941694

16951695
router.get('express.ping', [prepareBitGo(config), typedPromiseWrapper(handlePing)]);
1696-
router.get('express.pingExpress', [typedPromiseWrapper(handlePingExpress)]);
1696+
router.get('express.v1.ping', [typedPromiseWrapper(handlePingExpress)]);
1697+
router.get('express.ping', [typedPromiseWrapper(handlePingExpress)]);
16971698

16981699
// auth
16991700
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 { PostV1Encrypt } from './v1/encrypt';
@@ -70,8 +71,11 @@ export const ExpressPingApiSpec = apiSpec({
7071
});
7172

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 BitGo 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+
* @private
13+
*/
14+
export const GetV1PingExpress = httpRoute({
15+
path: '/api/v1/pingexpress',
16+
method: 'GET',
17+
request: httpRequest({}),
18+
response: {
19+
200: t.type({ status: t.string }),
20+
404: BitgoExpressError,
21+
},
22+
});

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ 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
12+
* @public
1013
*/
11-
export const GetPingExpress = httpRoute({
12-
path: '/api/v[12]/pingexpress',
14+
export const GetV2PingExpress = httpRoute({
15+
path: '/api/v2/pingexpress',
1316
method: 'GET',
1417
request: httpRequest({}),
1518
response: {

0 commit comments

Comments
 (0)