Skip to content

Commit

Permalink
Fix an issue with types in functions
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk committed Nov 7, 2023
1 parent a237f69 commit 6902934
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Router} from "itty-router";
import type {Request} from "itty-router";

const router = Router();

Expand All @@ -8,7 +9,11 @@ const corsHeaders = {
"Access-Control-Max-Age": "86400"
};

router.get("/api/get-article-hits", async ({query, method, headers}, env) => {
interface CustomRequest extends Request {
headers: Headers;
}

router.get("/api/get-article-hits", async ({query, method, headers}: CustomRequest, env) => {
// handle CORS preflight request
if (method === "OPTIONS") {
return new Response(null, {headers: corsHeaders});
Expand Down

0 comments on commit 6902934

Please sign in to comment.