Skip to content

Commit

Permalink
Add a cloudflare worker for functionality testing
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfcarlson committed Jul 9, 2023
1 parent adbfaf9 commit 1f6b097
Show file tree
Hide file tree
Showing 6 changed files with 2,503 additions and 25 deletions.
5 changes: 0 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,5 @@
"ultrawides",
"unclip"
],
"workbench.colorCustomizations": {
"activityBar.background": "#09351E",
"titleBar.activeBackground": "#0D4A2B",
"titleBar.activeForeground": "#F3FDF8"
},
"grammarly.files.include": ["**/*.md", "**/*.txt"]
}
10 changes: 10 additions & 0 deletions functions/api/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { MatthewCPageFunction } from "../types";
// import Database from "../database/_db";
// import { deleteCookie, ResponseJsonAccessDenied, ResponseJsonMissingData, ResponseJsonNotFound, ResponseJsonNotImplementedYet, ResponseJsonServerError } from "../_utils";
// import { AuthCheck, AuthCheckZ, TEMP_TOKEN } from "./auth_types";


export const onRequestGet: MatthewCPageFunction = async function (context) {

return new Response("working = true;", { headers: { "Content-Type": "application/javascript" } },)
}
15 changes: 15 additions & 0 deletions functions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"strict": true,
"module": "CommonJS",
"lib": ["ES2020"],
"types": ["@cloudflare/workers-types", "node"]
},
"paths": {
"$/*": [
"*",
]
},
"include": ["**/*", "../*.d.ts"]
}
22 changes: 22 additions & 0 deletions functions/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// These are the types used by every honeydew page function

export type MatthewCPageEnv = {
PRODUCTION:"true"|"false"; // whether we are in production or not
//HONEYDEW: KVNamespace;
//HONEYDEWSQL: D1Database;
TURNSTILE: string; // the turnstile secret
}

export type MatthewCPageData = {
// db:Database;
timestamp:number;
// user: DbUser|null;
// authorized:boolean;
// jwt_raw: string;
// jwt?:JwtPayload;
// userid:UserId|null;
}

type MatthewCPageFunction<
Params extends string = any
> = (context: EventContext<MatthewCPageEnv, Params, MatthewCPageData>) => Response | Promise<Response>;
Loading

0 comments on commit 1f6b097

Please sign in to comment.