Upgrade to Pro — share decks privately, control downloads, hide ads and more …

We're all living on it. But what exactly is The...

We're all living on it. But what exactly is The Edge?

It’s 2022 and we’re all on the edge of our serverless seats. But what is The Edge? What are Edge Functions? And what impact does this new technology have on the Jamstack, the web, and ultimately — people and our planet?

Salma Alam-Naylor

August 11, 2022
Tweet

More Decks by Salma Alam-Naylor

Other Decks in Technology

Transcript

  1. 🤔 
 WE’RE ALL LIVING ON IT. BUT WHAT EXACTLY

    IS THE EDGE? SERVERLESS FUNCTIONS ⚙
  2. 🤔 
 WE’RE ALL LIVING ON IT. BUT WHAT EXACTLY

    IS THE EDGE? SERVERLESS + JAMSTACK SERVERLESS FUNCTIONS ⚙ 🍓
  3. 🤔 
 WE’RE ALL LIVING ON IT. BUT WHAT EXACTLY

    IS THE EDGE? SERVERLESS + JAMSTACK THE EDGE SERVERLESS FUNCTIONS ⚙ 🍓 🧗
  4. 🤔 
 WE’RE ALL LIVING ON IT. BUT WHAT EXACTLY

    IS THE EDGE? SERVERLESS + JAMSTACK THE EDGE SERVERLESS FUNCTIONS EDGE FUNCTIONS ON NETLIFY ⚙ 🍓 🧗 👩💻
  5. ADD EDGE FUNCTION FILES TO YOUR PROJECT ASSOCIATE YOUR 


    FUNCTIONS WITH URLS DEPLOY YOUR PROJECT 
 TO NETLIFY AS USUAL 1 2 3
  6. ADD EDGE FUNCTION FILES TO YOUR PROJECT ASSOCIATE YOUR 


    FUNCTIONS WITH URLS DEPLOY YOUR PROJECT 
 TO NETLIFY AS USUAL 1 2 3
  7. hello-edge.js export default async () => { return new Response("Hello,

    World!", { headers: { "content-type": "text/html" }, }); };
  8. hello-edge.js export default async (request) => { const url =

    new URL(request.url); if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  9. hello-edge.js export default async (request) => { const url =

    new URL(request.url); if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  10. hello-edge.js export default async (request) => { const url =

    new URL(request.url); if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  11. hello-edge.js export default async (request) => { const url =

    new URL(request.url); if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  12. hello-edge.js export default async (request) => { const url =

    new URL(request.url); if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  13. hello-edge.js export default async (request) => { const url =

    new URL(request.url); if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  14. hello-edge.js export default async (request, context) => { const url

    = new URL(request.url); const location = context.geo; if (url.searchParams.get("event") === "moar") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Hello, everyone else!"); } };
  15. hello-edge.js export default async (request, context) => { const url

    = new URL(request.url); const location = context.geo; if (url.searchParams.get("event") === “moar" && location.country.code === "GB") { return new Response("Hello, Moar Serverless!"); } else { return new Response(“Sorry, go away!”); } };
  16. hello-edge.js export default async (request, context) => { const url

    = new URL(request.url); const location = context.geo; if (url.searchParams.get("event") === "moar" && location.country.code === "GB") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Sorry, go away!", { status: 451, }); } };
  17. hello-edge.js export default async (request, context) => { const url

    = new URL(request.url); const location = context.geo; if (url.searchParams.get("event") === "moar" && location.country.code === "GB") { return new Response("Hello, Moar Serverless!"); } else { return new Response("Sorry, go away!", { status: 451, }); } };
  18. product-page.js export default async (request, context) => { const url

    = new URL(request.url); if (url.pathname.startsWith("/food")) { context.cookies.set("prefers", "food"); } if (url.pathname.startsWith("/corgis")) { context.cookies.set("prefers", "corgis"); } // return the Response and page };
  19. product-page.js export default async (request, context) => { const url

    = new URL(request.url); if (url.pathname.startsWith("/food")) { context.cookies.set("prefers", "food"); } if (url.pathname.startsWith("/corgis")) { context.cookies.set("prefers", "corgis"); } // return the Response and page };
  20. product-page.js export default async (request, context) => { const url

    = new URL(request.url); if (url.pathname.startsWith("/food")) { context.cookies.set("prefers", "food"); } if (url.pathname.startsWith("/corgis")) { context.cookies.set("prefers", "corgis"); } // return the Response and page };
  21. home-page.js export default async (request, context) => { const prefers

    = context.cookies.get("prefers"); if (prefers === "food") { context.rewrite("/home-page-food"); } if (prefers === "corgis") { context.rewrite("/home-page-corgis"); } // return the default Response and page };
  22. home-page.js export default async (request, context) => { const prefers

    = context.cookies.get("prefers"); if (prefers === "food") { context.rewrite("/home-page-food"); } if (prefers === "corgis") { context.rewrite("/home-page-corgis"); } // return the default Response and page };
  23. home-page.js export default async (request, context) => { const prefers

    = context.cookies.get("prefers"); if (prefers === "food") { context.rewrite("/home-page-food"); } if (prefers === "corgis") { context.rewrite("/home-page-corgis"); } // return the default Response and page };
  24. ADD EDGE FUNCTION FILES TO YOUR PROJECT ASSOCIATE YOUR 


    FUNCTIONS WITH URLS DEPLOY YOUR PROJECT 
 TO NETLIFY AS USUAL 1 2 3