diff --git a/modules/express/src/clientRoutes.ts b/modules/express/src/clientRoutes.ts index b1f151031f..c472225f83 100755 --- a/modules/express/src/clientRoutes.ts +++ b/modules/express/src/clientRoutes.ts @@ -83,7 +83,7 @@ function handlePing( return req.bitgo.ping(); } -function handlePingExpress(req: ExpressApiRouteRequest<'express.pingExpress', 'get'>) { +function handlePingExpress(req: ExpressApiRouteRequest<'express.pingexpress', 'get'>) { return { status: 'express server is ok!', }; @@ -1693,7 +1693,8 @@ export function setupAPIRoutes(app: express.Application, config: Config): void { app.use(router); router.get('express.ping', [prepareBitGo(config), typedPromiseWrapper(handlePing)]); - router.get('express.pingExpress', [typedPromiseWrapper(handlePingExpress)]); + router.get('express.v1.pingexpress', [typedPromiseWrapper(handlePingExpress)]); + router.get('express.pingexpress', [typedPromiseWrapper(handlePingExpress)]); // auth router.post('express.login', [prepareBitGo(config), typedPromiseWrapper(handleLogin)]); diff --git a/modules/express/src/typedRoutes/api/index.ts b/modules/express/src/typedRoutes/api/index.ts index 0e7396bbae..3280ca9a97 100644 --- a/modules/express/src/typedRoutes/api/index.ts +++ b/modules/express/src/typedRoutes/api/index.ts @@ -3,7 +3,8 @@ import { apiSpec } from '@api-ts/io-ts-http'; import * as express from 'express'; import { GetPing } from './common/ping'; -import { GetPingExpress } from './common/pingExpress'; +import { GetV1PingExpress } from './v1/pingExpress'; +import { GetV2PingExpress } from './v2/pingExpress'; import { PostLogin } from './common/login'; import { PostV1Decrypt } from './v1/decrypt'; import { PostV2Decrypt } from './v2/decrypt'; @@ -71,8 +72,11 @@ export const ExpressPingApiSpec = apiSpec({ }); export const ExpressPingExpressApiSpec = apiSpec({ - 'express.pingExpress': { - get: GetPingExpress, + 'express.v1.pingexpress': { + get: GetV1PingExpress, + }, + 'express.pingexpress': { + get: GetV2PingExpress, }, }); diff --git a/modules/express/src/typedRoutes/api/v1/pingExpress.ts b/modules/express/src/typedRoutes/api/v1/pingExpress.ts new file mode 100644 index 0000000000..094f5e710c --- /dev/null +++ b/modules/express/src/typedRoutes/api/v1/pingExpress.ts @@ -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 BitGo Express (v1) + * + * Ping bitgo express to ensure that it is still running. Unlike /ping, this does not try connecting to bitgo.com. + * + * @operationId express.v1.pingexpress + * @tag Express + * @private + */ +export const GetV1PingExpress = httpRoute({ + path: '/api/v1/pingexpress', + method: 'GET', + request: httpRequest({}), + response: { + 200: t.type({ status: t.string }), + 404: BitgoExpressError, + }, +}); diff --git a/modules/express/src/typedRoutes/api/common/pingExpress.ts b/modules/express/src/typedRoutes/api/v2/pingExpress.ts similarity index 51% rename from modules/express/src/typedRoutes/api/common/pingExpress.ts rename to modules/express/src/typedRoutes/api/v2/pingExpress.ts index 3b3e80ccf3..a712b9f1f0 100644 --- a/modules/express/src/typedRoutes/api/common/pingExpress.ts +++ b/modules/express/src/typedRoutes/api/v2/pingExpress.ts @@ -3,13 +3,16 @@ import { httpRoute, httpRequest } from '@api-ts/io-ts-http'; import { BitgoExpressError } from '../../schemas/error'; /** - * Ping Express + * Ping BitGo Express * - * @operationId express.pingExpress - * @tag express + * Ping bitgo express to ensure that it is still running. Unlike /ping, this does not try connecting to bitgo.com. + * + * @operationId express.pingexpress + * @tag Express + * @public */ -export const GetPingExpress = httpRoute({ - path: '/api/v[12]/pingexpress', +export const GetV2PingExpress = httpRoute({ + path: '/api/v2/pingexpress', method: 'GET', request: httpRequest({}), response: {