The serverless API for our final software engineering project.

12345678910111213141516171819202122232425
  1. import { NOTION_KEY } from "../config";
  2. const { Client } = require("@notionhq/client");
  3. export const notion = new Client({ auth: NOTION_KEY });
  4. export type DatabaseType = "laws" | "advice";
  5. /**
  6. * Translates incoming GET parameters into a valid block ID.
  7. * @param type
  8. * @returns string
  9. */
  10. export function getDatabaseId(type: DatabaseType): string | undefined {
  11. switch (type) {
  12. case "laws":
  13. return "d02fa51eda254c9fa4b97e5f9beb1a86";
  14. case "advice":
  15. return "9515c0f02e454e968c44336bd1beb463";
  16. default:
  17. return undefined;
  18. }
  19. }