Skip to content

Commit cf47f8f

Browse files
authored
fix: show status endpoint in /extended (#1869)
1 parent e71b111 commit cf47f8f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

docs/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ paths:
20032003
example:
20042004
$ref: ./api/core-node/get-info.example.json
20052005

2006-
/extended/v1/status:
2006+
/extended:
20072007
get:
20082008
summary: API status
20092009
description: Retrieves the running status of the Stacks Blockchain API, including the server version and current chain tip information.

src/api/init.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export async function startApiServer(opts: {
150150
app.set('etag', false);
151151

152152
app.get('/', (req, res) => {
153-
res.redirect(`/extended/v1/status`);
153+
res.redirect(`/extended/`);
154154
});
155155

156156
app.use('/doc', (req, res) => {
@@ -189,6 +189,7 @@ export async function startApiServer(opts: {
189189
res.set('Cache-Control', 'no-store');
190190
next();
191191
});
192+
router.use('/', createStatusRouter(datastore));
192193
router.use(
193194
'/v1',
194195
(() => {
@@ -203,7 +204,9 @@ export async function startApiServer(opts: {
203204
v1.use('/info', createInfoRouter(datastore));
204205
v1.use('/stx_supply', createStxSupplyRouter(datastore));
205206
v1.use('/debug', createDebugRouter(datastore));
206-
v1.use('/status', createStatusRouter(datastore));
207+
v1.use('/status', (req, res) =>
208+
res.redirect(`${req.baseUrl.replace(/v1\/status/, '')}${getReqQuery(req)}`)
209+
);
207210
v1.use('/fee_rate', createFeeRateRouter(datastore));
208211
v1.use('/tokens', createTokenRouter(datastore));
209212

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async function init(): Promise<void> {
110110
if (isProdEnv && !fs.existsSync('.git-info')) {
111111
throw new Error(
112112
'File not found: .git-info. This generated file is required to display the running API version in the ' +
113-
'`/extended/v1/status` endpoint. Please execute `npm run build` to regenerate it.'
113+
'`/extended/` endpoint. Please execute `npm run build` to regenerate it.'
114114
);
115115
}
116116
chainIdConfigurationCheck();

src/tests/other-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ describe('other tests', () => {
302302
});
303303

304304
test('active status', async () => {
305-
const result = await supertest(api.server).get(`/extended/v1/status/`);
305+
const result = await supertest(api.server).get(`/extended/`);
306306
expect(result.body.status).toBe('ready');
307307
});
308308

0 commit comments

Comments
 (0)