2 ms·
This is excellent! Would you mind open sourcing the code for that?
by tiffanyh 3y ago
This is excellent!
Would you mind open sourcing the code for that?
- louison11 3y agoThis is the code running this endpoint: export function onRequest(context) { return new Response(JSON.stringify([parseFloat(context.request.cf.longitude), parseFloat(context.request.cf.latitude)]), {headers: {"Content-Type": "application/json;charset=UTF-8"}}) } This is a function on Cloudflare Pages (which is just a different name for Cloudflare Workers). Minor adjustment needed for Workers (get rid of "context", I believe)