feat(api): add issues and version endpoints
This commit is contained in:
parent
c1d2a3d93a
commit
46aefd4688
27
packages/api/src/routes/v5/version.ts
Normal file
27
packages/api/src/routes/v5/version.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { FastifyInstance, RouteShorthandOptions } from 'fastify';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
import environment from 'services/environment';
|
||||||
|
|
||||||
|
export default (server: FastifyInstance, _options: RouteShorthandOptions, done: () => void) => {
|
||||||
|
server.get('/version/', async (_request, reply) => {
|
||||||
|
try {
|
||||||
|
const options = { headers: { 'Cache-Control': 'no-cache' } };
|
||||||
|
const url = `${environment.github.files}/packages/browser-extension/src/manifest.json`;
|
||||||
|
const { version } = await (await fetch(url, options)).json();
|
||||||
|
|
||||||
|
reply.send({
|
||||||
|
data: {
|
||||||
|
version,
|
||||||
|
},
|
||||||
|
success: true,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
reply.send({
|
||||||
|
errors: [error.message],
|
||||||
|
success: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user