Skip to content

Commit 62c38a5

Browse files
committed
Add getinfo API
1 parent 69810ee commit 62c38a5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/controllers/api.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import logger from "../logger";
1010
import { genHashFromFile, setDir } from "../util";
1111
import { APP_DIR } from "../vars";
1212

13+
const VERSION = process.env.npm_package_version;
1314
const TMP_DIR = "tmp";
1415
const CONSIGNMENTS_DIR = "consignments";
1516
const MEDIA_DIR = "media";
@@ -348,4 +349,15 @@ export const loadApiEndpoints = (app: Application): void => {
348349
}
349350
}
350351
);
352+
353+
app.get(
354+
"/getinfo",
355+
middleware,
356+
async (_req: Request, res: Response) => {
357+
return res.status(200).send({
358+
version: VERSION,
359+
uptime: Math.trunc(process.uptime()),
360+
});
361+
}
362+
);
351363
};

0 commit comments

Comments
 (0)