Browse Source

Merge pull request #2460 from nocodb/feat/health-api

feat: health api
pull/2490/head
Pranav C 2 years ago committed by GitHub
parent
commit
3aab9a17c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/noco-docs/content/en/developer-resources/rest-apis.md
  2. 20
      packages/nocodb-sdk/src/lib/Api.ts
  3. 11
      packages/nocodb/src/lib/meta/api/utilApis.ts
  4. 23
      scripts/sdk/swagger.json

3
packages/noco-docs/content/en/developer-resources/rest-apis.md

@ -166,7 +166,8 @@ Currently, the default value for {orgs} is <b>noco</b>. Users will be able to ch
| Meta | Delete| utils | cacheDelete | /api/v1/db/meta/cache |
| Meta | Post | utils | testConnection | /api/v1/db/meta/projects/connection/test |
| Meta | Get | utils | appInfo | /api/v1/db/meta/nocodb/info |
| Meta | Get | utils | appVersion | /api/v1/db/meta/nocodb/version |
| Meta | Get | utils | appVersion | /api/v1/version |
| Meta | Get | utils | appHealth | /api/v1/health |
## Query params

20
packages/nocodb-sdk/src/lib/Api.ts

@ -3197,12 +3197,28 @@ export class Api<
*
* @tags Utils
* @name AppVersion
* @request GET:/api/v1/db/meta/nocodb/version
* @request GET:/api/v1/version
* @response `200` `any` OK
*/
appVersion: (params: RequestParams = {}) =>
this.request<any, any>({
path: `/api/v1/db/meta/nocodb/version`,
path: `/api/v1/version`,
method: 'GET',
format: 'json',
...params,
}),
/**
* No description
*
* @tags Utils
* @name AppHealth
* @request GET:/api/v1/health
* @response `200` `any` OK
*/
appHealth: (params: RequestParams = {}) =>
this.request<any, any>({
path: `/api/v1/health`,
method: 'GET',
format: 'json',
...params,

11
packages/nocodb/src/lib/meta/api/utilApis.ts

@ -60,6 +60,14 @@ export async function releaseVersion(_req: Request, res: Response) {
res.json(result);
}
export async function appHealth(_: Request, res: Response) {
res.json({
message: 'OK',
timestamp: Date.now(),
uptime: process.uptime()
});
}
async function _axiosRequestMake(req: Request, res: Response) {
const { apiMeta } = req.body;
@ -132,6 +140,7 @@ export default router => {
ncMetaAclMw(testConnection, 'testConnection')
);
router.get('/api/v1/db/meta/nocodb/info', catchError(appInfo));
router.get('/api/v1/db/meta/nocodb/version', catchError(releaseVersion));
router.post('/api/v1/db/meta/axiosRequestMake', catchError(axiosRequestMake));
router.get('/api/v1/version', catchError(releaseVersion));
router.get('/api/v1/health', catchError(appHealth));
};

23
scripts/sdk/swagger.json

@ -5107,7 +5107,7 @@
]
}
},
"/api/v1/db/meta/nocodb/version": {
"/api/v1/version": {
"parameters": [],
"get": {
"summary": "",
@ -5128,6 +5128,27 @@
"description": ""
}
},
"/api/v1/health": {
"parameters": [],
"get": {
"summary": "",
"operationId": "utils-app-health",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"tags": [
"Utils"
],
"description": ""
}
},
"/api/v1/db/meta/cache": {
"get": {
"summary": "Your GET endpoint",

Loading…
Cancel
Save