Simple API gateway for webhooks

fix: country endpoint

finxol.io f287eb09 e4e0f18e

verified
+10 -10
+1 -1
deno.json
··· 8 8 }, 9 9 "tasks": { 10 10 "start": "deno run --allow-net --allow-env src/main.ts", 11 - "dev": "DENO_ENV=dev deno run --env-file --watch --allow-net --allow-env src/main.ts" 11 + "dev": "DENO_ENV=dev deno run --tunnel --env-file --watch --allow-net --allow-env src/main.ts" 12 12 }, 13 13 "unstable": ["kv"], 14 14 "compilerOptions": {
+7 -7
src/main.ts
··· 53 53 `) 54 54 }) 55 55 56 - if (Deno.env.get("DENO_ENV") === "dev") { 57 - const { default: data } = await import("../test.json", { with: { type: "json" } }) 58 - kv.set( 59 - ["sensors", "latest"], 60 - { ...data }, 61 - ) 62 - } 56 + // if (Deno.env.get("DENO_ENV") === "dev") { 57 + // const { default: data } = await import("../test.json", { with: { type: "json" } }) 58 + // kv.set( 59 + // ["sensors", "latest"], 60 + // { ...data }, 61 + // ) 62 + // } 63 63 64 64 Deno.serve(app.fetch)
+1 -1
src/sensors.ts
··· 174 174 const country = ReverseGeocodingSchema.safeParse(geocode.value) 175 175 176 176 if (!country.success) { 177 - console.error(country.error) 177 + console.error("ReverseGeocodingSchema validation failed:", country.error) 178 178 return c.text("Invalid country data", 400) 179 179 } 180 180
+1 -1
src/util.ts
··· 97 97 98 98 // Fetch the data from the URL 99 99 const data = await tryCatch( 100 - fetch(url).then((res) => res.json() as T), 100 + fetch(url).then((res) => res.json()), 101 101 ) 102 102 103 103 if (!data.success) {