├── .gitignore ├── netlify.toml ├── .vscode └── settings.json ├── index.html └── netlify └── edge-functions └── hello-world.ts /.gitignore: -------------------------------------------------------------------------------- 1 | # Local Netlify folder 2 | .netlify 3 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [[edge_functions]] 2 | path = "/" 3 | function = "hello-world" -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.enablePaths": [ 4 | "netlify/edge-functions" 5 | ], 6 | "deno.unstable": true, 7 | "deno.importMap": ".netlify/edge-functions-import-map.json" 8 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello World Personalization 8 | 9 | 10 |

Hello chat!

11 | 12 | 13 | -------------------------------------------------------------------------------- /netlify/edge-functions/hello-world.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'https://edge.netlify.com'; 2 | 3 | export default async function (_request: Request, context: Context) { 4 | const response = await context.next(); 5 | const text = await response.text(); 6 | 7 | const city = context.geo.city; 8 | 9 | const newText = `${text} ${city}`; 10 | 11 | return new Response(newText.toLocaleUpperCase(), response); 12 | } 13 | --------------------------------------------------------------------------------