8// Initialize Notion client
9const notion = new Client({
10 auth: Deno.env.get("NOTION_API_KEY"),
11});
12```
13
14Keeping controllers in this directory and importing them into our routes keeps our API endpoints thin and easier to work with. (See the /tasks directory as an example.)
15
16## Re: /controllers and /utils
7### Task endpoints use /controllers to get and save data
8
9In order to keep the API easy to look and work with, the routes in /tasks handle routing but do not get data from or save data to Notion. The functions that connect to Notion live in the /controllers directory, and are _called_ from the endpoints in /tasks.
10
11### Naming convention for routes and controllers
13 console.log(page.id);
14 // get the cobrowse value from the payload
15 // warning: properties in Notion are capitalized as a convention (see Cobrowse)
16 const cobrowse = page.properties.Cobrowse.checkbox ? false : true;
17 // save new cobrowse boolean to Notion page
1import { Hono } from "npm:hono";
2import { getPage } from "../../controllers/page.controller.ts";
3
4const app = new Hono();
5
1import { Hono } from "npm:hono";
2import { getPage } from "../../controllers/page.controller.ts";
3
4const app = new Hono();
5
1import { Hono } from "npm:hono";
2import { getDatabase } from "../../controllers/database.controller.ts";
3
4const app = new Hono();
5
1import { blob } from "https://esm.town/v/std/blob?v=12";
2import { Hono } from "npm:hono";
3import { blobKeyForDemoCobrowseStatus } from "../../../shared/utils/blobKeyForDemoCobrowseStatus.ts";
4
5const app = new Hono();
1import { Hono } from "npm:hono";
2import {
3 getDemoInteractions,
4 getAllInteractionsPages,
5} from "../../controllers/actions.controller.ts";
1import { Hono } from "npm:hono";
2import { setAction } from "../../controllers/action.controller.ts";
3
4const app = new Hono();
5
9
10 useEffect(() => {
11 fetch("/api/styles")
12 .then(res => res.json())
13 .then(data => {