Skip to content

Commit

Permalink
add version endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Sep 5, 2023
1 parent da3cc9b commit acb7fdc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/pages/api/version.ts
Original file line number Diff line number Diff line change
@@ -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);
};

0 comments on commit acb7fdc

Please sign in to comment.