mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
add version endpoint
This commit is contained in:
parent
da3cc9b065
commit
acb7fdcae8
1 changed files with 17 additions and 0 deletions
17
src/pages/api/version.ts
Normal file
17
src/pages/api/version.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { ok, methodNotAllowed } from 'next-basics';
|
||||
import { CURRENT_VERSION } from 'lib/constants';
|
||||
|
||||
export interface VersionResponse {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export default async (req: NextApiRequest, res: NextApiResponse<VersionResponse>) => {
|
||||
if (req.method === 'GET') {
|
||||
return ok(res, {
|
||||
version: CURRENT_VERSION,
|
||||
});
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue