<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Serverless on Aamnah - Frontend Web Developer</title>
    <link>https://aamnah.com/notes/serverless/</link>
    <description>Recent content in Serverless on Aamnah - Frontend Web Developer</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 05 Jun 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://aamnah.com/notes/serverless/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Netlify Functions and Netlify Edge Functions</title>
      <link>https://aamnah.com/notes/serverless/netlify-edge-functions/</link>
      <pubDate>Sat, 30 Dec 2023 11:17:41 +0200</pubDate>
      <guid>https://aamnah.com/notes/serverless/netlify-edge-functions/</guid>
      <description>&lt;p&gt;Summary&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;how to create a function file&lt;/li&gt;&#xA;&lt;li&gt;how to save and use environment variables&lt;/li&gt;&#xA;&lt;li&gt;how to install and use third party packages&lt;/li&gt;&#xA;&lt;li&gt;how to run your functions locally and on live remote&lt;/li&gt;&#xA;&lt;li&gt;how to pass data to netlify functions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;functions-vs-edge-functions&#34;&gt;Functions vs. Edge Functions&lt;/h2&gt;&#xA;&lt;p&gt;There are &lt;em&gt;functions&lt;/em&gt; and there are &lt;em&gt;edge functions&lt;/em&gt;. Both are serverless functions, with &lt;em&gt;edge&lt;/em&gt; function being served from CDN server locations closest to the user &lt;a href=&#34;https://www.netlify.com/blog/edge-functions-explained/&#34;&gt;ref&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Function can be created in TS, JS and Go; and are based on a &lt;strong&gt;Nodejs runtime&lt;/strong&gt;. (Tip: the Node version can be configured from the dashborad or &lt;code&gt;netlify.toml&lt;/code&gt; or &lt;code&gt;.nvmrc&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Edge Functions on the other hand are based on a &lt;strong&gt;Deno runtime&lt;/strong&gt; and can only be in TypeScript and JavaScript. &lt;a href=&#34;https://docs.netlify.com/edge-functions/get-started/#edge-functions-with-jsx-or-tsx&#34;&gt;&lt;code&gt;.jsx&lt;/code&gt;, &lt;code&gt;.tsx&lt;/code&gt; are also supported&lt;/a&gt; for SSR (server-side-handling)&lt;/li&gt;&#xA;&lt;li&gt;There will be minor differences between the two function types as the code will need to be adjusted for that particular runtime. For example, module imports are done differently.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Function or Edge Function? Which one to choose? Personally, i always go with &lt;code&gt;edge-functions&lt;/code&gt; because they&amp;rsquo;re simpler and i don&amp;rsquo;t have to worry about module formats. The only reason i would choose &lt;code&gt;functions&lt;/code&gt; is if i wanted to write Go functions&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
