23}
24
25// Fetch handler
26export async function GET(): Promise<Response> {
27 const rows = [...db.query("SELECT id, text, last_completed_date FROM todos")]
4app.get("/", (c) => c.text("Hono!"));
5
6export default app.fetch;
27
28 // Send the text back to the user
29 await fetch(`https://api.twilio.com/2010-04-01/Accounts/${sid}/Messages.json`, {
30 method: "POST",
31 headers: {
1import * as NodeIcal from "npm:node-ical";
2
3type FetchPanchangeOptions = {
4 /** https://www.geonames.org/ */
5 geoname: string;
10};
11
12async function fetchPanchangIcal(options: FetchPanchangeOptions) {
13 const ical = fetch(
14 "https://www.drikpanchang.com/ajax/ical/panchangam/dp-grid-panchangam-ical.php",
15 {
33}
34
35const ical = await fetchPanchangIcal({
36 date_from: "01/07/2025",
37 date_to: "03/07/2025",
1import { MhahPanchang } from "npm:mhah-panchang";
2import { fetchGeolocation } from "https://esm.town/v/mattrossman/geolocation/main.ts";
3
4export default async function (req: Request) {
5 const panchang = new MhahPanchang();
6 const now = new Date();
7 const geolocation = await fetchGeolocation(req);
8 const calendar = panchang.calendar(
9 now,
1# geolocation
2
3A helper function to fetch geolocation data from [ip-api](https://ip-api.com/)
4based on a visitor's IP address
5
6```ts
7import { fetchGeolocation } from "https://esm.town/v/mattrossman/geolocation/main.ts";
8
9export default async function (req: Request) {
10 const geolocation = await fetchGeolocation(req);
11 return new Response(`You're visiting from ${geolocation.city}`);
12}
21};
22
23export async function fetchGeolocation(req: Request) {
24 const ip = await getIp(req);
25 if (ip === undefined) throw new Error(`Missing "x-forwarded-for" header`);
26
27 const json = await fetch(`http://ip-api.com/json/${ip}`).then(
28 (res) => res.json(),
29 ) as IpApiGeolocation;
33
34export default async function (req: Request): Promise<Response> {
35 const geolocation = await fetchGeolocation(req);
36 return Response.json(geolocation);
37}
1import { fetchGeolocation } from "https://esm.town/v/mattrossman/geolocation/main.ts";
2
3export default async function (req: Request) {
4 const geolocation = await fetchGeolocation(req);
5 return new Response(`Hello from ${geolocation.city}`);
6}
62formData.append('html', 'your HTML goes here...');
63
64fetch('https://ishbrzero--086bc172453a11f0896c76b3cceeab13.web.val.run', {
65 method: 'POST',
66 body: formData,
20 if (!xForwardedFor) throw new Error(`Missing "x-forwarded-for" header`);
21
22 const json = await fetch(`http://ip-api.com/json/${xForwardedFor}`).then(
23 (res) => res.json(),
24 ) as IpApiResponse;