Skip to content

Commit

Permalink
Removed export endpoint
Browse files Browse the repository at this point in the history
/ now returns metadata
Reintroduced emails
  • Loading branch information
james-pre committed Jul 15, 2024
1 parent 0eaf80d commit d0003c1
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 379 deletions.
49 changes: 0 additions & 49 deletions functions/export.ts

This file was deleted.

18 changes: 15 additions & 3 deletions functions/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import { StatusCodes } from 'http-status-codes';
import { response } from '../src/backend/utils';
import { version } from '../package.json';
import type { RequestContext } from '../src/backend/context';
import { error, response } from '../src/backend/utils';
import type { Metadata } from '../src/generic';

export function onRequest(): Response {
return response(StatusCodes.OK, {});
export async function onRequest({ env }: RequestContext) {
try {
const metadata: Metadata = {
version,
debug: !!env.DEBUG,
};
return response(StatusCodes.OK, metadata, false);
} catch (e) {
console.error(e);
return error(StatusCodes.INTERNAL_SERVER_ERROR, env.DEBUG && e?.message);
}
}
2 changes: 0 additions & 2 deletions functions/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { StatusCodes } from 'http-status-codes';
import { version } from '../package.json';
import { setDB } from '../src/backend/api';
import type { RequestContext } from '../src/backend/context';
import { error, response } from '../src/backend/utils';
import type { Metadata } from '../src/generic';

export async function onRequest({ env }: RequestContext) {
try {
setDB(env.DB);
const metadata: Metadata = {
version,
debug: !!env.DEBUG,
Expand Down
Loading

0 comments on commit d0003c1

Please sign in to comment.