Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

add version endpoint

Francis Caoacb7fdcae8eb
diff --git a/src/pages/api/version.ts b/src/pages/api/version.ts
new file mode 100644
index 000000000..4453b56f0
--- /dev/null
+++ b/src/pages/api/version.ts
@@ -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);
+};