tangled
alpha
login
or
join now
finxol.io
/
hooks
0
fork
atom
Simple API gateway for webhooks
0
fork
atom
overview
issues
pulls
pipelines
debug: add logs
finxol.io
1 month ago
dd8c3a33
e4e0f18e
verified
This commit was signed with the committer's
known signature
.
finxol.io
SSH Key Fingerprint:
SHA256:olFE3asYdoBMScuJOt60UxXdJ0RFdGv5kVKrdOtIcPI=
0/1
deploy.yaml
failed
2s
+14
-9
2 changed files
expand all
collapse all
unified
split
src
main.ts
sensors.ts
+7
-7
src/main.ts
···
53
53
`)
54
54
})
55
55
56
56
-
if (Deno.env.get("DENO_ENV") === "dev") {
57
57
-
const { default: data } = await import("../test.json", { with: { type: "json" } })
58
58
-
kv.set(
59
59
-
["sensors", "latest"],
60
60
-
{ ...data },
61
61
-
)
62
62
-
}
56
56
+
// if (Deno.env.get("DENO_ENV") === "dev") {
57
57
+
// const { default: data } = await import("../test.json", { with: { type: "json" } })
58
58
+
// kv.set(
59
59
+
// ["sensors", "latest"],
60
60
+
// { ...data },
61
61
+
// )
62
62
+
// }
63
63
64
64
Deno.serve(app.fetch)
+7
-2
src/sensors.ts
···
171
171
return c.text("Geoapify API error", 404)
172
172
}
173
173
174
174
+
console.log(
175
175
+
"Geoapify response structure:",
176
176
+
JSON.stringify(geocode.value, null, 2),
177
177
+
)
178
178
+
174
179
const country = ReverseGeocodingSchema.safeParse(geocode.value)
175
180
176
181
if (!country.success) {
177
177
-
console.error(country.error)
182
182
+
console.error("ReverseGeocodingSchema validation failed:", country.error)
178
183
return c.text("Invalid country data", 400)
179
184
}
180
185
···
222
227
}),
223
228
async (c) => {
224
229
const body = c.req.valid("json")
225
225
-
console.log(`Receiving sensor data at ${body.timestamp.toISOString()}`)
230
230
+
console.log(`Receiving sensor data at ${body.timestamp.toISOString()}`, body)
226
231
227
232
// save data to kv store
228
233
await kv.set(["sensors", body.timestamp.toISOString()], body)