<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: SHAWNHOSEA</title>
    <description>The latest articles on Forem by SHAWNHOSEA (@shawnhosea).</description>
    <link>https://forem.com/shawnhosea</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F341012%2Fd8cbe916-6692-459d-87ee-57d2dd946f7b.jpeg</url>
      <title>Forem: SHAWNHOSEA</title>
      <link>https://forem.com/shawnhosea</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shawnhosea"/>
    <language>en</language>
    <item>
      <title>Apollo GraphQL &amp; Begin starter example</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 21:58:06 +0000</pubDate>
      <link>https://forem.com/begin/apollo-graphql-begin-starter-example-20g2</link>
      <guid>https://forem.com/begin/apollo-graphql-begin-starter-example-20g2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough of creating an Apollo GraphQL app on Begin. It should take less than 15 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hello there, Beginner!&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;This tutorial uses the &lt;a href="https://github.com/begin-examples/node-apollo" rel="noopener noreferrer"&gt;Apollo GraphQL Begin starter example&lt;/a&gt;, extended by an example API endpoint.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is GraphQL?
&lt;/h3&gt;

&lt;p&gt;Created by Facebook in parallel with React, GraphQL is a query language that defines a set of constraints for APIs. It has a built-in server-side runtime for fulfilling those queries with your existing data. Basically, it is used to load data from a server to a client &lt;strong&gt;-- it’s a way to get data from an API into your application.&lt;/strong&gt; The principles of GraphQL are extremely useful building blocks for web applications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To learn more about GraphQL click &lt;a href="https://graphql.org/learn/" rel="noopener noreferrer"&gt;here&lt;/a&gt; to check out their docs!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is Apollo?
&lt;/h3&gt;

&lt;p&gt;Apollo is the industry-standard GraphQL implementation, providing the data graph layer that connects modern apps to the cloud.&lt;/p&gt;

&lt;p&gt;The Apollo platform is an implementation of GraphQL that can transfer data between the cloud (server) to the UI of your app. In fact, Apollo builds its environment in such a way that we can use it to handle GraphQL on the client as well as the server-side of the application.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To learn more about Apollo click &lt;a href="https://www.apollographql.com/docs/" rel="noopener noreferrer"&gt;here&lt;/a&gt; to checkout their docs!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along and make your first Apollo app in Begin!&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create your Apollo app
&lt;/h3&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-apollo" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff79yf7cmfwwws1ibigcl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff79yf7cmfwwws1ibigcl.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F817b2zlnxof17bs3pv9e.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F817b2zlnxof17bs3pv9e.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://dev.to/en/getting-started/builds-deploys#configuring-build-steps"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), check your code's syntax for issues (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your basic Apollo GraphQL app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9nxgv61b9c8gcb5vi1mp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9nxgv61b9c8gcb5vi1mp.jpg" alt="apollo-screen"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Make your first commit
&lt;/h2&gt;

&lt;p&gt;If you'd like to jump right into making your first commit and running your first build, click the &lt;code&gt;Edit on GitHub&lt;/code&gt; button. This will open your app's code in GitHub and allow you to make a quick change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F944n1k2apibf6kuj0zo7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F944n1k2apibf6kuj0zo7.jpg" alt="begin-activity-2"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Look for this code, and try changing the text of the &lt;code&gt;h1&lt;/code&gt; to say &lt;code&gt;My Begin + Apollo GraphQL API&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Customize your site by changing the text of the h1&lt;/span&gt;
 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center-text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Begin&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;Apollo&lt;/span&gt; &lt;span class="nx"&gt;GraphQL&lt;/span&gt; &lt;span class="nx"&gt;API&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&amp;gt; /&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;Edit&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;section&lt;/span&gt;
      &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;padding-0 background-color-dark border-radius-4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;pre&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;code&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;color-light&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Loading&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/code&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;pre&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click the &lt;strong&gt;commit changes&lt;/strong&gt; button on GitHub, and head back to your &lt;code&gt;Activity&lt;/code&gt; view to watch it build.&lt;/p&gt;

&lt;p&gt;When it's done, don't forget to see your changes live in your &lt;code&gt;staging&lt;/code&gt; environment!&lt;/p&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next, let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the &lt;strong&gt;clone or download the&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory, install your dependencies, and start the local dev server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a &lt;code&gt;localhost&lt;/code&gt; link in your terminal – go ahead and visit that in your browser.&lt;/p&gt;

&lt;p&gt;That's all you need to do preview your changes locally before pushing them to &lt;code&gt;staging&lt;/code&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders in the source tree of your Apollo app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
├── src/
│   └── http/
│       └── post-graphql/
└── &lt;span class="nb"&gt;test&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go over each of these directories and how you may use them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;public/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;public&lt;/code&gt; directory is where we host our home page: &lt;code&gt;index.html&lt;/code&gt;. Inside we have an example GraphQL query that pulls in data from our HTTP function using an async function that fetches our GraphQL data graph from &lt;code&gt;src/http/post-graphql/index.js&lt;/code&gt;. We then append our query results to a DOM element using &lt;code&gt;getElementById&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// public/index.html&lt;/span&gt;

 &lt;span class="c"&gt;&amp;lt;!--&lt;/span&gt; &lt;span class="nx"&gt;Example&lt;/span&gt; &lt;span class="nx"&gt;GraphQL&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;
 &lt;span class="c1"&gt;// Fetch data graph layer&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`{hello}`&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/graphql&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;post&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
        &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;X-Requested-With&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="c1"&gt;// Append results to div element&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})()&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;src/http/post-graphql/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;POST /graphql&lt;/code&gt; function constructs a schema, using GraphQL schema language and then sets up a GraphQL server that will enforce our schema's structure. Afterwards, we provide resolver functions for your schema fields that will output our &lt;code&gt;Hello World&lt;/code&gt; string! To learn more about GraphQL schemas, check out this section of the Apollo docs: &lt;a href="https://www.apollographql.com/docs/tutorial/schema/" rel="noopener noreferrer"&gt;Build a schema&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/http/post-graphql/index.js&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ApolloServer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;gql&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apollo-server-lambda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Construct a schema, using GraphQL schema language&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;typeDefs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;gql&lt;/span&gt;&lt;span class="s2"&gt;`
  type Query {
    hello: String
  }
`&lt;/span&gt;
&lt;span class="c1"&gt;// Provide resolver functions for your schema fields&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;Query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello world!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ApolloServer&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;typeDefs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHandler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;helpers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;// Body is now parsed, re-encode to JSON for Apollo&lt;/span&gt;
  &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the next section, we will go more in-depth about how to provision HTTP functions in your Apollo GraphQL app by setting up a function that displays the GraphQL playground.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/http-functions/introduction" rel="noopener noreferrer"&gt;HTTP functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/test/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your Apollo GraphQL project comes built-in with a few boilerplate tests to ensure that things are running smoothly in your app. We've even loaded some example tests for &lt;strong&gt;web integration&lt;/strong&gt; &amp;amp; &lt;strong&gt;Begin data&lt;/strong&gt; in the &lt;code&gt;src/test/example/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;A solid platform is the foundation of a durable application, but tests are essential!&lt;/p&gt;

&lt;p&gt;You can find the test script specified in package.json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// package.json&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NODE_ENV=testing tape test/*-test.js | tap-spec&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tests run via &lt;code&gt;npm test&lt;/code&gt; or &lt;code&gt;npm t&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;While you can use any test runner and reporter combo you want, we recommend the &lt;a href="https://testanything.org/" rel="noopener noreferrer"&gt;TAP family&lt;/a&gt; for testing. Test suites that require their runners to inject globals can create some very difficult to debug situations.&lt;/p&gt;

&lt;p&gt;With that said, &lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Jest&lt;/a&gt;, &lt;a href="https://airbnb.io/enzyme/" rel="noopener noreferrer"&gt;Enzyme&lt;/a&gt;, &lt;a href="https://mochajs.org/" rel="noopener noreferrer"&gt;Mocha&lt;/a&gt;, etc. are all options available to you!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;the project structure of Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  GraphQL Playground
&lt;/h2&gt;

&lt;p&gt;The GraphQL Playground is an IDE (Integrated development environment) for better development workflows (GraphQL Subscriptions, interactive docs &amp;amp; collaboration). This playground is where you can test out your GraphQL queries for your app. You can learn more about the &lt;a href="https://github.com/prisma-labs/graphql-playground" rel="noopener noreferrer"&gt;GraphQL Playground here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fntkv7m4ie018w279uyxi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fntkv7m4ie018w279uyxi.jpg" alt="graphql-playground"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Provision new route for GraphQL Playground
&lt;/h3&gt;

&lt;p&gt;Let's make a new route that displays our GraphQL playground on its own page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ready to give it a go?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Head to your app’s repo folder&lt;/li&gt;
&lt;li&gt;Open the &lt;code&gt;app.arc&lt;/code&gt; file in your root&lt;/li&gt;
&lt;li&gt;Find the @http pragma, and on a new line, add the route &lt;code&gt;get /playground&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Start the local dev environment (npm start) to generate any new HTTP Function handlers&lt;/li&gt;
&lt;li&gt;Push your changes!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your new route(s) will instantly activate in staging. Then deploy to production to see them there, too.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your app’s existing &lt;code&gt;app.arc&lt;/code&gt; file has a commented warning about not editing it, go ahead and remove that – it's time to start editing that file!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Inside of your project folder, navigate to the &lt;code&gt;src/http/get-playground/index.js&lt;/code&gt; file. This &lt;a href="https://github.com/prisma-labs/graphql-playground/blob/master/packages/graphql-playground-html/minimal.html" rel="noopener noreferrer"&gt;repo here&lt;/a&gt; provides the code that will display our playground. The code is also written below. Copy and paste this code inside of the &lt;code&gt;index.js&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="nx"&gt;DOCTYPE&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt; &lt;span class="nx"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;utf&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;viewport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;GraphQL&lt;/span&gt; &lt;span class="nx"&gt;Playground&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/title&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;link&lt;/span&gt; &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;stylesheet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/css/index.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;link&lt;/span&gt; &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shortcut icon&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;//cdn.jsdelivr.net/npm/graphql-playground-react/build/favicon.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/js/middleware.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/head&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;background&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;58&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Open&lt;/span&gt; &lt;span class="nx"&gt;Sans&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sans&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="nx"&gt;vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;justify&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;margin&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/style&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;//cdn.jsdelivr.net/npm/graphql-playground-react/build/logo.png&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;loading&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;Loading&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;GraphQL&lt;/span&gt; &lt;span class="nx"&gt;Playground&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;load&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;GraphQLPlayground&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/graphql&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/body&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/html&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's add a button that will take us to our new playground route. Head to the &lt;code&gt;public&lt;/code&gt; directory and open the &lt;code&gt;index.html&lt;/code&gt; file. Add this block of code in between the &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;

&lt;p&gt;Add this block of code after the &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; tag inside of the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// public/index.html

  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/playground"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;GraphQL Playground&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This link navigates to our new GraphQL playground.&lt;/p&gt;

&lt;p&gt;Your new GraphQL playground is set up and connected to your data graph. Test out some new queries grow your database!&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent!&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You've now got a shiny new Apollo GraphQL app hosted on Begin – nice work.&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20Apollo-GraphQL%20site%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Get help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;More about Apollo&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.apollographql.com/" rel="noopener noreferrer"&gt;Apollo home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.apollographql.com/docs/" rel="noopener noreferrer"&gt;Apollo docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=mSzUb7f47qk" rel="noopener noreferrer"&gt;LevelUpTuts - What Is Apollo?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;More about GraphQL&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=783ccP__No8&amp;amp;t=140s" rel="noopener noreferrer"&gt;GraphQL: The Documentary&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://graphql.org/" rel="noopener noreferrer"&gt;GraphQL home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://graphql.org/learn/" rel="noopener noreferrer"&gt;GraphQL docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/prisma-labs/graphql-playground" rel="noopener noreferrer"&gt;GraphQL Playground&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Getting started using Vue on Begin</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 21:02:59 +0000</pubDate>
      <link>https://forem.com/begin/getting-started-using-vue-on-begin-39pa</link>
      <guid>https://forem.com/begin/getting-started-using-vue-on-begin-39pa</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough of creating a Vue app on Begin. It should take less than 15 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hello there, Beginner!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This tutorial uses the &lt;a href="https://vuejs.org/"&gt;Vue&lt;/a&gt; starter app, extended by an example API endpoint. You'll have all the capabilities of Vue for building beautiful user interfaces, combined with the power, speed, and security of cloud functions and serverless data storage.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Vue.js?
&lt;/h3&gt;

&lt;p&gt;Vue (pronounced like view) is a progressive framework for building user interfaces. The core library is focused on the view layer only and is easy to pick up and integrate with other libraries or existing projects. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with modern tooling and supporting libraries.&lt;/p&gt;

&lt;p&gt;If you’d like to learn more about Vue before diving in, here is a &lt;a href="https://www.vuemastery.com/courses/intro-to-vue-js/vue-instance/"&gt;video&lt;/a&gt; walking through the core principles of Vue and a sample project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;Although it would be helpful to have some experience with Vue, it's not required to follow along with this tutorial. (Related, the &lt;a href="https://vuejs.org/v2/guide/"&gt;Vue docs&lt;/a&gt; are a great reference.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along and make your first Vue app in Begin!&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create your new Vue app
&lt;/h3&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-vue"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yYw27_-V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.begin.com/deploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UKeP3SAb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iohyts6opzocxrzts07w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UKeP3SAb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iohyts6opzocxrzts07w.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fZewdYjQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wt7mmykt59jv1rtn0128.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fZewdYjQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wt7mmykt59jv1rtn0128.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), test your code's syntax (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your Vue app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nAs1NpyL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/erxu0qic5ixb1pcyvubo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nAs1NpyL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/erxu0qic5ixb1pcyvubo.jpg" alt="vue-intro"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Make your first commit
&lt;/h2&gt;

&lt;p&gt;If you'd like to jump right into making your first commit and running your first build, click the &lt;code&gt;Edit on GitHub&lt;/code&gt; button. This will open your app's code in GitHub and allow you to make a quick change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mw-ZICOH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vb3t562r3422h0ikzbx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mw-ZICOH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vb3t562r3422h0ikzbx.jpg" alt="begin-activity-2"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Look for this code, and try editing your basic app. Let's edit the &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; tag that says "Change me!" to "My app!":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Customize your site by changing the data below&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&amp;gt; /&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;Start&lt;/span&gt; &lt;span class="nx"&gt;by&lt;/span&gt; &lt;span class="nx"&gt;editing&lt;/span&gt; &lt;span class="nx"&gt;here&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;For&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;guide&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;recipes&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;how&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;configure&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;customize&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;br&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;check&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://cli.vuejs.org&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;_blank&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;noopener&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;vue&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;cli&lt;/span&gt; &lt;span class="nx"&gt;documentation&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;.
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click the &lt;strong&gt;commit changes&lt;/strong&gt; button on GitHub, and head back to your &lt;code&gt;Activity&lt;/code&gt; view to watch it build.&lt;/p&gt;

&lt;p&gt;When it's done, don't forget to see your changes live in your &lt;code&gt;staging&lt;/code&gt; environment!&lt;/p&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next, let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory, install your dependencies, and start the local dev server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a &lt;code&gt;localhost&lt;/code&gt; link in your terminal – go ahead and visit that in your browser.&lt;/p&gt;

&lt;p&gt;That's all you need to do preview your changes locally before pushing them to &lt;code&gt;staging&lt;/code&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Vue CLI
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://cli.vuejs.org/"&gt;Vue CLI&lt;/a&gt; is a command-line interface that acts as standard tooling for Vue.js development. It's feature-rich with out-of-the-box support for Babel, Typescript, ESLint, Unit Testing &amp;amp; End-to-end Testing. You create, develop and manage your projects through an accompanying graphical user interface. It's really cool and you might want to set it up in your project for future use. We'll show you how to do that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started
&lt;/h3&gt;

&lt;p&gt;Since we've already created our project and have it set up locally on our machine, all we have to do is install the CLI globally and run the command to start the GUI(graphical user interface)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install globally:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @vue/cli
&lt;span class="c"&gt;# OR&lt;/span&gt;
yarn global add @vue/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Start GUI:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vue ui

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you start the GUI, you will see this screen load up in your browser on &lt;code&gt;http://localhost:8000&lt;/code&gt;&lt;br&gt;
Our project is already on our local machine so let's click the import button to sync our project and the GUI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SzWNoniX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgf49sodlk5mq61qicwq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SzWNoniX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgf49sodlk5mq61qicwq.jpg" alt="vue-cli-1"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Look for your begin-vue-app project folder and click &lt;code&gt;import this folder&lt;/code&gt; as shown in the screen below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D8dCHdH7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ux6dy4ali54hb885j6rt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D8dCHdH7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ux6dy4ali54hb885j6rt.jpg" alt="vue-cli-2"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now we're synced. Welcome to your new project! Vue CLI and the accompanying GUI tool give you tremendous insight and analytics into your Vue app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i8t8n9KF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ovqkyqyv9tkc4p8qb5n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i8t8n9KF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ovqkyqyv9tkc4p8qb5n.jpg" alt="vue-cli-3"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Be sure to head over to the &lt;a href="https://cli.vuejs.org/guide/"&gt;Vue CLI docs&lt;/a&gt; to learn everything that you can do with these Vue development tools.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders and files in the source tree of your Vue app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
├── src/
│    ├── assets/
│    ├── components/
│    ├── http/
│    │   └── get-api/
│    ├── App.vue
│    └── main.js
└── &lt;span class="nb"&gt;test&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go over each of these directories &amp;amp; files and learn how you may use them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;public/index.html&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;public/index.html&lt;/code&gt; is the page served in the browser. Vue is a single-page application framework. It's used to create single-page applications(SPA). It loads just one file which is the &lt;code&gt;index.html&lt;/code&gt; file. The div with an id of &lt;code&gt;app&lt;/code&gt; (as seen in the code below) is a placeholder for our Vue application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// public/index.html

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"app"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file &lt;code&gt;public/index.html&lt;/code&gt; is a template that will be processed with html-webpack-plugin. During build, asset links will be injected automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/assets/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;All of our apps static assets(images) can be exported from this folder and imported into our components via relative paths.&lt;br&gt;
When you reference a static asset using relative paths (must start with .) inside JavaScript, CSS or *.vue files, the asset will be included into your Webpack dependency graph.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;src/components/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;You guessed it. This directory is where we keep our apps components.&lt;/p&gt;

&lt;p&gt;Components are one of the most powerful features of Vue.js and can be reused as many times as you want. They help you extend basic HTML elements to encapsulate reusable code. At a high level, components are custom elements that Vue.js’ compiler would attach specified behavior to. Think of them as reusable Vue instances with a name!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; &lt;a href="https://v1.vuejs.org/guide/components.html"&gt;Go here to learn more about using components in Vue&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;src/http/get-api/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The cloud function that handles example API requests is found at &lt;code&gt;src/http/get-api/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Some Begin apps are inert static web sites – but not this one. Your Vue app utilizes this built-in small, fast, individually executing cloud function that handles HTTP API requests and responses. (We call those HTTP functions, for short.)&lt;/p&gt;

&lt;p&gt;The HTTP function that handles requests to &lt;code&gt;GET /api&lt;/code&gt; is found in &lt;code&gt;src/http/get-api/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the next section, we will go more in-depth about how to provision HTTP functions in your Vue app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/http-functions/introduction"&gt;HTTP functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;./App.vue&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This &lt;code&gt;./App.vue&lt;/code&gt; file is a component that is structured like any other component you would build inside of a Vue application. It has a template tag for our markup that is loading an image from our &lt;code&gt;src/assets&lt;/code&gt; folder and another component called &lt;code&gt;HelloWorld.vue&lt;/code&gt; from our &lt;code&gt;src/components&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;The script tag is for our JS and where we import in our HelloWorld component.&lt;/p&gt;

&lt;p&gt;The style tag is for our CSS styling. In this particular component the styles affect our app globally. Whenever you see a &lt;code&gt;&amp;lt;style scoped&amp;gt;&lt;/code&gt; tag inside of a component, just know that those particular styles are scoped only to that particular component.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;main.js&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In our &lt;code&gt;src&lt;/code&gt; folder you will find a &lt;code&gt;main.js&lt;/code&gt; file which is the entry point into Vue. Here we import Vue and our main app component which is a file called &lt;code&gt;./App.vue&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We create a new Vue instance and we render the app component inside of an element with the id of &lt;code&gt;app&lt;/code&gt;. This would be the div in &lt;code&gt;public/index.html&lt;/code&gt; that has an id of 'app'.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;src/test/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your Vue project comes built-in with a few boilerplate tests to ensure that things are running smoothly in your app. We've even loaded some example tests for &lt;strong&gt;web integration&lt;/strong&gt; &amp;amp; &lt;strong&gt;Begin data&lt;/strong&gt; in the &lt;code&gt;/test/example/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;A solid platform is the foundation of a durable application, but tests are essential!&lt;/p&gt;

&lt;p&gt;Tests run via &lt;code&gt;npm test&lt;/code&gt; or &lt;code&gt;npm t&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;While you can use any test runner and reporter combo you want, we recommend the &lt;a href="https://testanything.org/"&gt;TAP family&lt;/a&gt; for testing. Test suites that require their runners to inject globals can create some very difficult to debug situations.&lt;/p&gt;

&lt;p&gt;With that said, &lt;a href="https://cli.vuejs.org/"&gt;Vue CLI&lt;/a&gt; has built-in options for unit testing with &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt; or &lt;a href="https://mochajs.org/"&gt;Mocha&lt;/a&gt; that works out of the box. There is also the official &lt;a href="https://vue-test-utils.vuejs.org/"&gt;Vue Test Utils&lt;/a&gt; which provides more detailed guidance for custom setups.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/introduction"&gt;the project structure of Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Using API endpoints
&lt;/h2&gt;

&lt;p&gt;Now for the fun part! Let's go over how HTTP functions work.&lt;/p&gt;

&lt;p&gt;The text in the red box below is actually being fetched from an example API endpoint, handled by &lt;code&gt;src/http/get-api/index.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SpX01dWI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dppi7hz1jh20mzc5tyn4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SpX01dWI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dppi7hz1jh20mzc5tyn4.jpg" alt="vue-api"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The output of this HTTP function can be called by fetching &lt;code&gt;GET /api&lt;/code&gt;, and subsequently used by any component within your Vue app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/http/get-api/index.js&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Begin API called&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json; charset=utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello from your Begin API!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's navigate to &lt;code&gt;src/App.vue&lt;/code&gt; to see how this HTTP function is being implemented into your app. &lt;code&gt;./App.vue&lt;/code&gt; is our apps root component. Inside of the script tag you will find an import of our HelloWorld component. This component actually holds and displays the data from our Begin endpoint. As you can see below, &lt;code&gt;GET /api/&lt;/code&gt; is fetched via async function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/App.vue&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;HelloWorld&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./components/HelloWorld.vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Loading...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;components&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;HelloWorld&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;mounted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then if we head over to our &lt;code&gt;/components/HelloWorld.vue&lt;/code&gt; we'll find the &lt;code&gt;h1&lt;/code&gt; receiving the message prop being passed down from our apps root component &lt;code&gt;./App.vue&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&amp;gt; /&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="nx"&gt;passed&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can probably see by now, being able to fetch and display data within your app serverlessly is an awesome way to extend the capabilities of your Vue app.&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent.&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You've now got a shiny new Vue app hosted on Begin – nice work.&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20Vue%20app%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;More about Vue

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vuejs.org/"&gt;Vue docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cli.vuejs.org/"&gt;Vue CLI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://forum.vuejs.org/"&gt;Vue forum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=FtXd_qQJgfI"&gt;What Is Vue JS?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=Wy9q22isx3U"&gt;Vue JS Crash Course&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Create React App starter running on Begin.</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 14:07:34 +0000</pubDate>
      <link>https://forem.com/begin/create-react-app-starter-running-on-begin-28ga</link>
      <guid>https://forem.com/begin/create-react-app-starter-running-on-begin-28ga</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough of creating a React app on Begin. It should take less than 15 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hello there, Beginner!&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;This tutorial uses the &lt;a href="https://github.com/facebook/create-react-app" rel="noopener noreferrer"&gt;Create React App&lt;/a&gt; starter app, extended by an example API endpoint. You'll have all the capabilities of React for building beautiful user interfaces, combined with the power, speed, and security of cloud functions and serverless data storage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;Although it would be helpful to have some experience with React, it's not required to follow along with this tutorial. (Related, the &lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;React docs&lt;/a&gt; are a great reference.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along and make a React app in Begin!&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create your new React app
&lt;/h3&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-create-react-app" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb18r2psa1f95or57ktut.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb18r2psa1f95or57ktut.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvztyl9sme9hdeqxwwbpk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvztyl9sme9hdeqxwwbpk.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps" rel="noopener noreferrer"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), check your code's syntax for issues (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your react app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6fqhtf3syjelv7xrwnc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6fqhtf3syjelv7xrwnc.jpg" alt="react-intro"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Make your first commit
&lt;/h2&gt;

&lt;p&gt;If you'd like to jump right into making your first commit and running your first build, click the &lt;code&gt;Edit on GitHub&lt;/code&gt; button. This will open your app's code in GitHub and allow you to make a quick change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqai32ie4hqtfkkk2l0d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqai32ie4hqtfkkk2l0d.jpg" alt="begin-activity-2"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Look for this code, and try editing your basic app. Let's edit the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag that says "Change me!" to "My app!":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Customize your site by changing the data below&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;Me&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt; /&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="err"&gt;←&lt;/span&gt; &lt;span class="nx"&gt;Start&lt;/span&gt; &lt;span class="nx"&gt;by&lt;/span&gt; &lt;span class="nx"&gt;editing&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click the &lt;strong&gt;commit changes&lt;/strong&gt; button on GitHub, and head back to your &lt;code&gt;Activity&lt;/code&gt; view to watch it build.&lt;/p&gt;

&lt;p&gt;When it's done, don't forget to see your changes live in your &lt;code&gt;staging&lt;/code&gt; environment!&lt;/p&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory, install your dependencies, and start the local dev server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a &lt;code&gt;localhost&lt;/code&gt; link in your terminal – go ahead and visit that in your browser.&lt;/p&gt;

&lt;p&gt;That's all you need to do preview your changes locally before pushing them to &lt;code&gt;staging&lt;/code&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders and files in the source tree of your personal website:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── api/
│    └── index.js
├── build/
├── public/
├── src/
│    └── App.js
└── &lt;span class="nb"&gt;test&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go over each of these directories and files and how you may use them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;api/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;api&lt;/code&gt; folder is where the cloud function that handles &lt;code&gt;GET&lt;/code&gt; requests to &lt;code&gt;/api&lt;/code&gt; lives. When we call our &lt;code&gt;api&lt;/code&gt; from our app it will execute the handler function in the &lt;code&gt;index.js&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Some Begin apps are inert static websites – but not this one. Your React app utilizes this built-in small, fast, individually executing cloud function that handles HTTP API requests and responses. (We call those HTTP functions, for short.)&lt;/p&gt;

&lt;p&gt;In the next section, we will go more in-depth about how to provision HTTP functions in your React app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/http-functions/introduction" rel="noopener noreferrer"&gt;HTTP functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;build/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;build&lt;/code&gt; folder is where your React app will build into (and be served from locally). Since this folder contains build artifacts, it isn't checked into git and shouldn't be directly modified. Instead, let your app re-build its contents.&lt;/p&gt;

&lt;p&gt;Each time your app is deployed by Begin, the build artifacts in &lt;code&gt;build&lt;/code&gt; will automatically be published to your app's static asset bucket (on &lt;a href="https://aws.amazon.com/s3/" rel="noopener noreferrer"&gt;S3&lt;/a&gt;) as well as Begin's CDN.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;public/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Per Create React App convention, files placed into &lt;code&gt;public&lt;/code&gt; are not processed, and will instead be copied into &lt;code&gt;build&lt;/code&gt; when your app is built.&lt;/p&gt;

&lt;p&gt;Add images (like your logo) and any other static assets or files to &lt;code&gt;public&lt;/code&gt; to make them publicly accessible in your app. &lt;a href="https://create-react-app.dev/docs/using-the-public-folder" rel="noopener noreferrer"&gt;Learn more about the &lt;code&gt;public&lt;/code&gt; folder&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/App.js&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Along with the other boilerplate React app files (&lt;code&gt;src/App.css&lt;/code&gt;, &lt;code&gt;src/App-test.js&lt;/code&gt;, etc.), &lt;code&gt;src/App.js&lt;/code&gt; serves as the primary entry point for your React app. This is a great place to start tinkering with your app.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/test/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your React project comes built-in with a few boilerplate tests to ensure that things are running smoothly in your app. We've even loaded some example tests for &lt;strong&gt;web integration&lt;/strong&gt; &amp;amp; &lt;strong&gt;Begin data&lt;/strong&gt; in the &lt;code&gt;src/test/example/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;A solid platform is the foundation of a durable application, but tests are essential!&lt;/p&gt;

&lt;p&gt;You can find the test script specified in package.json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// package.json&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NODE_ENV=testing tape test/*-test.js | tap-spec&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tests run via &lt;code&gt;npm test&lt;/code&gt; or &lt;code&gt;npm t&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;While you can use any test runner and reporter combo you want, we recommend the &lt;a href="https://testanything.org/" rel="noopener noreferrer"&gt;TAP family&lt;/a&gt; for testing. Test suites that require their runners to inject globals can create some very difficult to debug situations.&lt;/p&gt;

&lt;p&gt;With that said, &lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Jest&lt;/a&gt;, &lt;a href="https://airbnb.io/enzyme/" rel="noopener noreferrer"&gt;Enzyme&lt;/a&gt;, &lt;a href="https://github.com/testing-library/react-testing-library" rel="noopener noreferrer"&gt;React Testing Library&lt;/a&gt;, etc. are all options available to you!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;the project structure of Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Using API endpoints
&lt;/h2&gt;

&lt;p&gt;Now for the fun part! Let's go over how HTTP functions work.&lt;/p&gt;

&lt;p&gt;The text in the red box below is actually being fetched an example API endpoint, handled by &lt;code&gt;api/index.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5pwnw2ebamp985tb6jl7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5pwnw2ebamp985tb6jl7.jpg" alt="react-api"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The output of this HTTP function can be called by fetching &lt;code&gt;GET /api&lt;/code&gt;, and subsequently used by any component within your React app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// api/index.js&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;http&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Begin API called&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json; charset=utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello from your Begin API!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's navigate to &lt;code&gt;src/App.js&lt;/code&gt; to see how this HTTP function was being implemented into your app. As you can see below, &lt;code&gt;GET /api/&lt;/code&gt; is fetched via async function wrapped in a React hook (&lt;code&gt;useEffect&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/App.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;...loading&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchData&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Edit&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/code&amp;gt; and save to reload&lt;/span&gt;&lt;span class="err"&gt;.
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-link&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://reactjs.org&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;_blank&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;noopener noreferrer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Learn&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/header&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just one small example of how using a live API endpoint powered by an HTTP function can make your React app dynamic. Just think of all the things you can build this way!&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent.&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You've now got a shiny new React app hosted on Begin – nice work.&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20React%20app%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;More about React:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;React home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/getting-started.html" rel="noopener noreferrer"&gt;React docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://create-react-app.dev/docs/getting-started/" rel="noopener noreferrer"&gt;CRA Getting Started&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Setting up a Svelte app running on Begin</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 13:51:22 +0000</pubDate>
      <link>https://forem.com/begin/setting-up-a-svelte-app-running-on-begin-ijg</link>
      <guid>https://forem.com/begin/setting-up-a-svelte-app-running-on-begin-ijg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough of creating a Svelte app on Begin. It should take less than 5 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hello there, Beginner!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This tutorial walks through setting up a Svelte app running on Begin. &lt;a href="https://svelte.dev/" rel="noopener noreferrer"&gt;Svelte&lt;/a&gt; is a new approach to building user interfaces; unlike many frontend frameworks that do the bulk of their work in the browser (like React and Vue), Svelte shifts that work into a compile step that happens when you build your app. Today you'll learn how to create a Svelte app powered by Begin HTTP functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along and make a Svelte app in Begin!.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create your Svelte app
&lt;/h3&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-svelte" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmw48t3n3invtw43zao8o.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmw48t3n3invtw43zao8o.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbv9h3mlor6ws6hrmzzdd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbv9h3mlor6ws6hrmzzdd.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps" rel="noopener noreferrer"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), check your code's syntax for issues (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your basic Svelte app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0z5sba5uq6cfqpn7d3vv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0z5sba5uq6cfqpn7d3vv.jpg" alt="svelte-screen"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Make your first commit
&lt;/h2&gt;

&lt;p&gt;If you'd like to jump right into making your first commit and running your first build, click the &lt;code&gt;Edit on GitHub&lt;/code&gt; button. This will open your app's code in GitHub and allow you to make a quick change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoxtec3rew36zbfupmxz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoxtec3rew36zbfupmxz.jpg" alt="begin-activity-2"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Look for this code, and try changing the text of the &lt;code&gt;h3&lt;/code&gt; tag and the color of the &lt;code&gt;h1&lt;/code&gt; tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Customize your site by changing the color of the h1&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;MESSAGE: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&amp;gt; /&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;--&lt;/span&gt; &lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Visit&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://svelte.dev/tutorial&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Svelte&lt;/span&gt; &lt;span class="nx"&gt;tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt; to learn how to build Svelte apps.&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;240&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nx"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;ff3e00&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- change color!&lt;/span&gt;
    &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;uppercase&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="nx"&gt;em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;640&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/style&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click the &lt;strong&gt;commit changes&lt;/strong&gt; button on GitHub, and head back to your &lt;code&gt;Activity&lt;/code&gt; view to watch it build.&lt;/p&gt;

&lt;p&gt;When it's done, don't forget to see your changes live in your &lt;code&gt;staging&lt;/code&gt; environment!&lt;/p&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next, let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory, install your dependencies, and start the local dev server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a &lt;code&gt;localhost&lt;/code&gt; link in your terminal – go ahead and visit that in your browser.&lt;/p&gt;

&lt;p&gt;That's all you need to do preview your changes locally before pushing them to &lt;code&gt;staging&lt;/code&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders in the source tree of your Svelte app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
├── src/
│   ├── http/
│   │   └── get-api/
│   ├── App.svelte
│   └── main.mjs
└── rollup.config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go over each of these directories and how you may use them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;public/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;public&lt;/code&gt; directory is where you'll add images and any other static assets or files you want to make publicly accessible in your app.&lt;/p&gt;

&lt;p&gt;Each time your app deploys, the contents of this folder will automatically be published to your app's static asset bucket on &lt;a href="https://aws.amazon.com/s3/" rel="noopener noreferrer"&gt;S3&lt;/a&gt; and Begin's CDN.&lt;/p&gt;

&lt;p&gt;This is also where your component-level CSS &amp;amp; JS are bundled, as well as your app's global CSS, which affects the entirety of your app's styling.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Exercise caution!&lt;/strong&gt; The full contents of this folder will be copied with each deploy, overwriting any existing files with the same name.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/http/get-api/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The cloud function that handles requests to your site is found at &lt;code&gt;src/http/get-api/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Some Begin apps are inert static web sites – but not this one. Your Svelte app is built on a small, fast, individually executing cloud function that handles your HTTP requests and responses. (We call those HTTP functions, for short.)&lt;/p&gt;

&lt;p&gt;The HTTP function that handles requests to &lt;code&gt;GET /api&lt;/code&gt; is found in &lt;code&gt;src/http/get-api/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the next section we will go more in-depth about how to provision HTTP functions in your Svelte app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/http-functions/introduction" rel="noopener noreferrer"&gt;HTTP functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/main.js&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The main entry point for your Svelte app, &lt;code&gt;src/main.js&lt;/code&gt; imports your &lt;code&gt;App.svelte&lt;/code&gt; file (your root app component). In this example, we initialize your app to &lt;code&gt;document.body&lt;/code&gt; and pass it a prop to demonstrate how props can be passed along to different components inside of your app.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/App.svelte&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;src/App.svelte&lt;/code&gt; is what's referred to as a single file component – it contains all of the code needed to display your frontend. The opening &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag contains JavaScript, and in this example it receives in props from &lt;code&gt;src/main.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;MESSAGE: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Right below the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag we have a section for our HTML – &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; – which can render variables from your script tag inside &lt;code&gt;{curly brackets}&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Visit&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://svelte.dev/tutorial&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Svelte&lt;/span&gt; &lt;span class="nx"&gt;tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt; to learn how to build Svelte apps.&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, at the bottom of &lt;code&gt;src/App.svelte&lt;/code&gt; we have a &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag, which contains all the CSS for this specific component.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;rollup.config.js&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://rollupjs.org/guide/en/" rel="noopener noreferrer"&gt;Rollup&lt;/a&gt; is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It allows us to use ES modules &lt;code&gt;import&lt;/code&gt; syntax so that we may create component-based applications. This config file bundles all of your component-level CSS and JS into the &lt;code&gt;public&lt;/code&gt; directory.&lt;/p&gt;




&lt;h2&gt;
  
  
  Using API endpoints
&lt;/h2&gt;

&lt;p&gt;Extending your Svelte app with HTTP functions may be why you're here, right? Let's take a look at how all this works.&lt;/p&gt;

&lt;p&gt;Let's start with the &lt;code&gt;src/App.svelte&lt;/code&gt; code inside &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag found below. When the component renders initially into a page or "mounts", we're able to use what's called a lifecycle method called &lt;code&gt;onMount&lt;/code&gt;, which is provided by the Svelte framework. Inside this &lt;code&gt;onMount&lt;/code&gt; handler we fetch data from &lt;code&gt;src/http/get-api/&lt;/code&gt; and then set the variable named &lt;code&gt;message&lt;/code&gt; with the returned data. We're now able to pass this variable into our HTML as props so that it displays a message from our HTTP function. Not bad, right?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/App.svelte&lt;/span&gt;

&lt;span class="c1"&gt;// JavaScript&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;onMount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;MESSAGE: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// HTML&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Change&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Visit&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://svelte.dev/tutorial&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Svelte&lt;/span&gt; &lt;span class="nx"&gt;tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt; to learn how to build Svelte apps.&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just one small example of how using a live API endpoint powered by an HTTP function can make your Svelte app dynamic. Just think of all the things you can build this way!&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent!&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You've now got a shiny new Svelte app hosted on Begin – nice work.&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20Svelte%20site%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;More about Svelte

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://svelte.dev/" rel="noopener noreferrer"&gt;Svelte docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://svelte.dev/blog/the-easiest-way-to-get-started" rel="noopener noreferrer"&gt;Svelte Quickstart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=AdNJ3fydeao&amp;amp;feature=emb_title" rel="noopener noreferrer"&gt;Rich Harris - Rethinking Reactivity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Begin personal website example app</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 13:16:25 +0000</pubDate>
      <link>https://forem.com/begin/begin-personal-website-example-app-db3</link>
      <guid>https://forem.com/begin/begin-personal-website-example-app-db3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough of creating a personal website on Begin. It should take less than 5 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hello there, Beginner!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This tutorial walks through setting up a fast, beautiful, custom personal site running on Begin. It uses example code that demonstrates server-side rendering, shared components, and static assets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along and make a new personal website with Begin!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's get started!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Get stoked, here's a little preview of your new site:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frsoecjx9gaj1mjky27dr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frsoecjx9gaj1mjky27dr.jpg" alt="begin-personal-site"&gt;&lt;/a&gt; &lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create your new personal website
&lt;/h3&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-personal-website" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w8gn6xht65tmftxsveu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w8gn6xht65tmftxsveu.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bngmcv3fajx7qwoqzne.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bngmcv3fajx7qwoqzne.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps" rel="noopener noreferrer"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), check your code's syntax for issues (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your personal site:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fow2nd0jsjxs23auhhlaq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fow2nd0jsjxs23auhhlaq.jpg" alt="begin-personal-site"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Make your first commit
&lt;/h2&gt;

&lt;p&gt;If you'd like to jump right into making your first commit and running your first build, click the &lt;code&gt;Edit on GitHub&lt;/code&gt; button. This will open your app's code in GitHub and allow you to make a quick change.&lt;/p&gt;

&lt;p&gt;Look for this code, and try editing your basic bio (like your name or location):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Customize your site by changing the data below&lt;/span&gt;
&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Index&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="cm"&gt;/**
     * Basic bio
     */&lt;/span&gt;
    &lt;span class="na"&gt;fullname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Your Name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// ← Start by adding your name!&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;My personal site!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;occupation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Artist &amp;amp; Photographer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;West Glacier, MT&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Lorem ipsum dolor sit amet...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click the &lt;strong&gt;commit changes&lt;/strong&gt; button on GitHub, and head back to your &lt;code&gt;Activity&lt;/code&gt; view to watch it build.&lt;/p&gt;

&lt;p&gt;When it's done, don't forget to see your changes live in your &lt;code&gt;staging&lt;/code&gt; environment!&lt;/p&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory, install your dependencies, and start the local dev server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a &lt;code&gt;localhost&lt;/code&gt; link in your terminal – go ahead and visit that in your browser.&lt;/p&gt;

&lt;p&gt;That's all you need to do preview your changes locally before pushing them to &lt;code&gt;staging&lt;/code&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders in the source tree of your personal website:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
└── src/
    ├── http/
    │   └── get-index/
    └── views/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go over each of these directories and how you may use them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;public/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;public&lt;/code&gt; directory where you'll add images (like the background image for your site) and any other static assets or files you want to make publicly accessible in your app.&lt;/p&gt;

&lt;p&gt;Each time your app deploys, the contents of this folder will automatically be published to your app's static asset bucket (on &lt;a href="https://aws.amazon.com/s3/" rel="noopener noreferrer"&gt;S3&lt;/a&gt;) as well as Begin's CDN.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Exercise caution!&lt;/strong&gt; The full contents of this folder will be copied with each deploy, overwriting any existing files with the same name.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/http/get-index/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The cloud function that handles requests to your site is found at &lt;code&gt;src/http/get-index/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Some Begin apps are inert static web sites – but not this one. Your personal website is built on a small, fast, individually executing cloud function that handles your HTTP requests and responses. (We call those HTTP functions, for short.)&lt;/p&gt;

&lt;p&gt;The HTTP function that handles requests to the root of your app (&lt;code&gt;GET /&lt;/code&gt;) is found in &lt;code&gt;src/http/get-index/&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/views/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;By default, the contents of &lt;code&gt;src/views/&lt;/code&gt; gets copied into each of your project's &lt;code&gt;GET&lt;/code&gt; HTTP functions (at &lt;code&gt;node_modules/@architect/views&lt;/code&gt; for Node, or &lt;code&gt;vendor/views&lt;/code&gt; for Ruby and Python) whenever you start the local dev server (or deploy your app).&lt;/p&gt;

&lt;p&gt;This means the modules in this folder can be used by any &lt;code&gt;GET&lt;/code&gt; HTTP function in your app.&lt;/p&gt;

&lt;p&gt;For example, here's how you'd &lt;code&gt;require&lt;/code&gt; &lt;code&gt;src/views/main.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;layout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/views/main&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;the project structure of Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Customize your site
&lt;/h2&gt;

&lt;p&gt;Now for the fun part! Let's customize your personal website and really make it your own.&lt;/p&gt;

&lt;p&gt;You've already changed the default name. Now let's add your social media links and change the background image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp9p8621kzcguo3epmyhl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp9p8621kzcguo3epmyhl.jpg" alt="begin-personal-site"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As you saw earlier, &lt;code&gt;/src/http/get-index/index.js&lt;/code&gt; is a great place to get started updating the content of your site. Open that file in your editor:&lt;/p&gt;

&lt;p&gt;Now let's input your social media handles in place of the dummy data. Go ahead and change the values of the &lt;code&gt;email&lt;/code&gt;, &lt;code&gt;twitter&lt;/code&gt;, &lt;code&gt;linkedin&lt;/code&gt;, &lt;code&gt;instagram&lt;/code&gt;, and &lt;code&gt;facebook&lt;/code&gt; keys – or remove any you don't want to keep.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/http/get-index/index.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/views/main.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;staticAssetsHelper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./static-assets-helper&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Customize your site by changing the data below&lt;/span&gt;
&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Index&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="cm"&gt;/**
     * Basic bio
     */&lt;/span&gt;
    &lt;span class="na"&gt;fullname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Your Name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// ←  Start by adding your name!&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;My personal site!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;occupation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Artist &amp;amp; Photographer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;West Glacier, MT&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus vel facilisis.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Contact / social
     * - Comment out any item below to remove it from your page
     */&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;your@email.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;twitter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourTwitter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;linkedin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;your-linkedin-name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;instagram&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourInsta&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;facebook&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;your-facebook-name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Layout
     */&lt;/span&gt;
    &lt;span class="na"&gt;photographer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Ivana Cajina&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unsplash&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;credit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://unsplash.com/@von_co&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;staticAssetsHelper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;background.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// or link to an external image URL such as ↓&lt;/span&gt;
    &lt;span class="c1"&gt;// image: 'https://images.unsplash.com/photo-1506535772317-9fdb71c959c6'&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/html; charset=utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nx"&gt;body&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/begin-examples/node-personal-website/blob/master/src/http/get-index/index.js" rel="noopener noreferrer"&gt;View source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we'll update your background image. Grab a new one &lt;a href="https://unsplash.com" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt; (or wherever you please) and place it in the &lt;code&gt;public/&lt;/code&gt;. Let's name this new image &lt;code&gt;background-2.jpg&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Go back to &lt;code&gt;/src/http/get-index/index.js&lt;/code&gt; and replace the current reference to &lt;code&gt;background.jpg&lt;/code&gt; with &lt;code&gt;background-2.jpg&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You may notice that your background image is being returned by a module named &lt;code&gt;staticAssetHelper&lt;/code&gt;. This helper demonstrates how to load static assets with the correct URLs locally, in staging, and via the Begin CDN in production.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok, let's see the finished product. With your local dev server running (&lt;code&gt;npm start&lt;/code&gt;), preview your site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjj4oxjn1bd09rbw5sibi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjj4oxjn1bd09rbw5sibi.jpg" alt="begin-personal-site-2"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;That's one beautiful personal website you've got there – customized to your liking! Time to deploy and show the world what you've just created.&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent.&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You've now got a shiny new personal website hosted on Begin – nice work.&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20personal%20site%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>CRUD app with data persistence</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 12:48:25 +0000</pubDate>
      <link>https://forem.com/begin/crud-app-with-data-persistence-26hh</link>
      <guid>https://forem.com/begin/crud-app-with-data-persistence-26hh</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough using Begin Data as your application's database. It should take less than 10 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Begin Data&lt;/a&gt; is an easy to use, fast, durable, highly scalable, fully managed, SSD-based key-value and document database built on top of AWS DynamoDB. And access to it is available for every Begin app!&lt;/p&gt;

&lt;p&gt;You can think of Begin Data as syntactic sugar for making DynamoDB easier to work with. Designed to accommodate most general persistence use cases, its core API has three simple methods: &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;set&lt;/code&gt;, and &lt;code&gt;destroy&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll show you how to set up and start using Begin Data with a simple todo CRUD app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along and make your first database-enabled app in Begin!&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-crud" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxzjrgr9qodvgcj91d4s.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxzjrgr9qodvgcj91d4s.jpg" alt="begin-repo-name"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ue811tw4p99hwaq7un6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ue811tw4p99hwaq7un6.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps" rel="noopener noreferrer"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), test your code's syntax (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your new app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F58sffsx8o75ndeaa90wq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F58sffsx8o75ndeaa90wq.jpg" alt="begin-crud"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the clone or download button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory and install your dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on staging and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders and files in the source tree of your new todo app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
└── src/
    └── http/
         ├── get-todos/
         ├── post-todos/
         └── post-todos-delete/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go over each of these directories and how you may use them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;public/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;public&lt;/code&gt; directory is where we host our home page: &lt;code&gt;index.html&lt;/code&gt;. This is also where our app's CSS styles and JavaScript live. Here, we'll fetch our todos from our HTTP functions and append them to elements in the DOM while manipulating the state of our app.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/http/get-todos/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;GET /todos&lt;/code&gt; function allows you to read the current &lt;code&gt;todos&lt;/code&gt; from your Begin Data &lt;code&gt;todos&lt;/code&gt; table; these items are created by way of the HTML form on the home page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// `src/http/get-todos/index.js`&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;todos&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;todos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;todos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="c1"&gt;// Return oldest todo first&lt;/span&gt;
  &lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;created&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;created&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json; charset=utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="nx"&gt;todos&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;src/http/post-todos/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;POST /todos&lt;/code&gt; function creates or updates todos in your Begin Data &lt;code&gt;todos&lt;/code&gt; table when input is posted from your app's HTML form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// `src/http/post-todos/index.js`&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;todo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;helpers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Base64 decodes + parses body&lt;/span&gt;
  &lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;created&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;created&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;todos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;todo&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;302&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;location&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;src/http/post-todos-delete/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;POST /todos/delete&lt;/code&gt; function deletes any of the todos from your Begin Data &lt;code&gt;todos&lt;/code&gt; table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// `src/http/post-todos-delete/index.js`&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;destroy&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;helpers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="c1"&gt;// Base64 decodes + parses body&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;todos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;key&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;302&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;location&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Add Begin Data
&lt;/h2&gt;

&lt;p&gt;First things first. We must always require Begin Data at the top of our functions. The &lt;code&gt;arc&lt;/code&gt; variable here is used for parsing request bodies in our functions. Follow the link to learn more about &lt;a href="https://arc.codes/docs/en/reference/app.arc/http#parsing-request-bodies" rel="noopener noreferrer"&gt;parsing request bodies&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Begin Data API
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;The core Begin Data API is three methods:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;data.get(params[, callback])&lt;/code&gt; → &lt;code&gt;[Promise]&lt;/code&gt; for retrieving data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data.set(params[, callback])&lt;/code&gt; → &lt;code&gt;[Promise]&lt;/code&gt; for writing data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data.destroy(params[, callback])&lt;/code&gt; → &lt;code&gt;[Promise]&lt;/code&gt; for removing data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Some additional helper methods are also available:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;data.incr(params[, callback])&lt;/code&gt; → &lt;code&gt;[Promise]&lt;/code&gt; increment an attribute on an item&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data.decr(params[, callback])&lt;/code&gt; → &lt;code&gt;[Promise]&lt;/code&gt; decrement an attribute on an item&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data.count(params[, callback])&lt;/code&gt; → &lt;code&gt;[Promise]&lt;/code&gt; get the number of items for a given table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All methods accept an object and, optionally, a Node-style errback. If no errback is supplied, a Promise is returned (thus, all methods support async / await).&lt;/p&gt;

&lt;h3&gt;
  
  
  Writes
&lt;/h3&gt;

&lt;p&gt;Let's start by saving a single item to a table with the &lt;code&gt;set&lt;/code&gt; method. We identify the table with the &lt;code&gt;table&lt;/code&gt; parameter, and can optionally specify a &lt;code&gt;key&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;taco&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;al-pastor&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since all items have a &lt;code&gt;key&lt;/code&gt;, if no &lt;code&gt;key&lt;/code&gt; is specified, a unique key will automatically be generated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tokens&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="c1"&gt;// { table: 'tokens', key: 'LCJkYX9jYWwidW50RhSU' }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also batch save multiple items to multiple &lt;code&gt;table&lt;/code&gt;s by passing &lt;code&gt;set&lt;/code&gt; an array of objects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;collection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ppl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;grace&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ghopper@navy.mil&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ppl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sutr0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sutr0@harbl.net&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pollo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;carnitas&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Reads
&lt;/h3&gt;

&lt;p&gt;Read an item by key with the &lt;code&gt;get&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;yum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;baja&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As with &lt;code&gt;set&lt;/code&gt;, &lt;code&gt;get&lt;/code&gt; can also batch-read by passing it an array of objects. With these building blocks you can construct secondary indexes and joins, like one-to-many and many-to-many!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;carnitas&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;al-pastor&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Destroy
&lt;/h3&gt;

&lt;p&gt;Delete an item by key with the &lt;code&gt;destroy&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pollo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yep, you guessed it: you can also batch-read delete items bypassing &lt;code&gt;destroy&lt;/code&gt; an array of objects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;carnitas&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tacos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;al-pastor&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Begin Data in action
&lt;/h2&gt;

&lt;p&gt;So how do all of these HTTP functions come together to compose the core functionality of the app? This happens inside &lt;code&gt;public/index.html&lt;/code&gt;. In your index file, the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; contains the code doing the heavy client-side lifting. Now let's take a look a bit closer at what's going on there.&lt;/p&gt;

&lt;p&gt;First, we fetch all the todos that currently reside on in the database. To ensure that that this fetch call always runs when the page is loaded, our business logic is immediately invoked:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Get all todos&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/todos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;same-origin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="c1"&gt;// Call update with fetched todos&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Kick off the app&lt;/span&gt;
&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we'll define a set of variables (see: &lt;code&gt;document.getElementById&lt;/code&gt; calls) that will append the correct state and data in our DOM (see: &lt;code&gt;innerHTML&lt;/code&gt; calls):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Update the DOM with data&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;js-todos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;js-completed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;js-message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;complete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;doneTitle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;js-done-title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;none&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;none&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/_static/rocket.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Let&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;s get started!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Rocket&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/_static/astronaut.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;You did it!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Astronaut&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;doneTitle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;display-none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Todo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;

  &lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Todo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent!&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You've just built a CRUD todo app and API, and understand how Begin Data can persist data for your application's storage needs.&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20Begin-Crud%20app%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;




&lt;h2&gt;
  
  
  Learn more about DynamoDB
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/dynamodb/" rel="noopener noreferrer"&gt;AWS DynamoDB&lt;/a&gt; is a fully managed, highly durable, non-relational key value and document database for applications that need performance at any scale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html" rel="noopener noreferrer"&gt;Learn more about DynamoDB here&lt;/a&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Begin scheduled functions</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 07:53:25 +0000</pubDate>
      <link>https://forem.com/begin/begin-scheduled-functions-9pp</link>
      <guid>https://forem.com/begin/begin-scheduled-functions-9pp</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough on creating scheduled functions with Begin. It should take less than 10 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Begin scheduled functions are an integral part of automating the background processes of your app. They enable you to set up recurring tasks to run on an interval.&lt;/p&gt;

&lt;p&gt;This gives you the ability to do things like regularly back up your application's database, or generate monthly reports based on user interactions. They are the serverless equivalent of a cron job.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll show you how you can backup some data in your Begin app with scheduled functions. First, let's discuss how to set up your project and get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things to follow along though.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log in to GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-scheduled" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbe7lh30fbvbob4x1x70b.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbe7lh30fbvbob4x1x70b.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy7gw9cmxjqo9wr93p8ur.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy7gw9cmxjqo9wr93p8ur.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes several predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps" rel="noopener noreferrer"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), test your code's syntax (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your new app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9rgxl0vtpzefj4q1ydi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9rgxl0vtpzefj4q1ydi.jpg" alt="begin-scheduled"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Hit the refresh button in your browser to see the view count rise higher. We'll learn more about what this application is doing under the hood after we've set up our project locally.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next, let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory and install your dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are all set to work on your app locally!&lt;/p&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders and files in the source (&lt;code&gt;src/&lt;/code&gt;) tree of your new app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── src/
│   ├── http/
│   │   └── get-index/
│   ├── scheduled/
│   │   └── backup/
│   └── views/
│       └── doc.js
└── app.arc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;src/http/get-index/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This is the root function of our app that serves the view. We must note that we are getting the actual &lt;code&gt;HTML&lt;/code&gt; from our shared &lt;code&gt;views&lt;/code&gt; directory (&lt;code&gt;src/views&lt;/code&gt;), which we'll discuss below. This function is also incrementing and storing each page view into your app's Begin Data database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/http/get-index/index.js&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;HTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/views/doc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;http&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;visits&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my-data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;site&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;prop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;visits&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="nx"&gt;visits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;visits&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Stored a visit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/html; charset=utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HTML&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;visits&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;src/scheduled/backup/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This is our scheduled function – the star of the app! We use this function to back up the view counts collected in Begin Data. This backup function's rate is defined in our &lt;code&gt;app.arc&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/scheduled/backup/index.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;scheduled&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;pages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;page&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my-data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;await &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;pages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Page: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Count: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// Now save a copy wherever you like (S3, POST to an external endpoint, etc.)!&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;src/views/doc.js&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This file is serving the HTML view of our app. Every module inside our &lt;code&gt;views&lt;/code&gt; folder is available to all of our &lt;code&gt;GET&lt;/code&gt; functions. Note: for brevity, the actual HTML contents of this file are truncated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/views/doc.js&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Doc&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;visits&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;visits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;visits&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  ...
&amp;lt;/html&amp;gt;
  `&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;app.arc&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your &lt;code&gt;app.arc&lt;/code&gt; file is where you'll provision new scheduled functions and other infra for your app. (In this particular app, you'll see that we have provisioned a scheduled function named &lt;code&gt;backup&lt;/code&gt; with a &lt;code&gt;rate&lt;/code&gt; every 6 hours.)&lt;/p&gt;

&lt;p&gt;Infrastructure-as-code is the practice of provisioning and maintaining cloud infrastructure using a declarative manifest file. It’s like package.json, except for cloud resources like API Gateway, Lambda, and DynamoDB (all of which Begin apps use).&lt;/p&gt;

&lt;p&gt;By checking in your Begin app’s project manifest (&lt;code&gt;app.arc&lt;/code&gt;) file with your code, you can ensure you have the cloud resources your code depends on. This is crucial for guaranteeing reproducibility and improving iteration speed.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/scheduled-functions/provisioning" rel="noopener noreferrer"&gt;provisioning and working with scheduled functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  How scheduled functions work in this app
&lt;/h2&gt;

&lt;p&gt;This app is designed to demonstrate the power of scheduled functions and Begin data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmt35u4mc2lghx531052g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmt35u4mc2lghx531052g.jpg" alt="begin-scheduled"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Inside the &lt;code&gt;app.arc&lt;/code&gt; file in the root of your project, we've added an entry to the &lt;code&gt;@scheduled&lt;/code&gt; pragma to provision a new scheduled function named &lt;code&gt;backup&lt;/code&gt;. This function runs on a 6 hour interval (&lt;code&gt;rate(6 hours)&lt;/code&gt;) that backs up the current number of page views (which are written to the database by our &lt;code&gt;get-index&lt;/code&gt; function). You can save this backup wherever you'd like, such as an S3 bucket.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Scheduled function names are lowercase alphanumeric and can contain dashes. They must declare a &lt;code&gt;rate&lt;/code&gt; with a number, and a time period with the appropriate singular / plural form, e.g. &lt;code&gt;rate(1 day)&lt;/code&gt;, &lt;code&gt;rate(2 weeks)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#RateExpressions" rel="noopener noreferrer"&gt;Read more about the &lt;code&gt;rate&lt;/code&gt; syntax here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You'll notice below the view count that there is a link to your scheduled functions logs inside the your Begin console. Clicking the link will take you this page to view these logs for your scheduled functions!&lt;/p&gt;

&lt;p&gt;Awesome! Now let's move on to deploying this app to production.&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent.&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You now have a good idea of how scheduled functions work within Begin. Your next task is to learn &lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Begin Data!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20scheduled%20functions%20app%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Begin event functions</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 07:36:12 +0000</pubDate>
      <link>https://forem.com/begin/begin-event-functions-577</link>
      <guid>https://forem.com/begin/begin-event-functions-577</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough on creating event functions with Begin. It should take less than 10 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Getting started with Begin event functions should take just a few minutes, but lay the groundwork for creating your own &lt;a href="https://aws.amazon.com/pub-sub-messaging/" rel="noopener noreferrer"&gt;publish / subscribe message bus&lt;/a&gt; for your application.&lt;/p&gt;

&lt;p&gt;Asynchronous tasks are a very common requirement in most modern applications. For example: say someone signs up for your newsletter.&lt;/p&gt;

&lt;p&gt;You don’t want your user to wait around for your application to respond while it makes API calls to your mailing list service.&lt;/p&gt;

&lt;p&gt;Instead, what you probably want is to publish a JSON payload to a dedicated, asynchronous subscribing event listener — this is commonly known as the pub / sub (or publish / subscribe) model.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll show you how you can kick off background tasks in your Begin app with event functions. First, let's discuss how to set up your project and get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github" rel="noopener noreferrer"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things to follow along though.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log in to GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-events" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.begin.com%2Fdeploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flv8qy3pfs2g60xaj9mkj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flv8qy3pfs2g60xaj9mkj.jpg" alt="begin-repo-name"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1349evbeckjayikfidcr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1349evbeckjayikfidcr.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes several predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps" rel="noopener noreferrer"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), test your code's syntax (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your new app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjsqmn57nnmm74a0ie8l.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjsqmn57nnmm74a0ie8l.jpg" alt="begin-events"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We'll learn more about what these three buttons do after the project is set up locally.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next, let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory and install your dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are all set to work on your app locally!&lt;/p&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders and files in the source tree of your new app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
│   └── index.html
├── src/
│   ├── events/
│   │   └── my-event/
│   └── http/
│       └── post-my_event/
└── app.arc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;public/index.html&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;public/index.html&lt;/code&gt; is the page served to the browser. Your app's styling can be found inside of this file along with our button form elements taking in attributes from the HTTP function &lt;code&gt;post-my_event&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/events/my-event/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your app utilizes this built-in small, fast, individually executing cloud function that handle subscribing to events – (We call those event functions, for short.)&lt;/p&gt;

&lt;p&gt;After receiving an incoming payload published from another function, this event handler then executes its business logic. (To tidy up the incoming event payloads, we suggest running your event functions through our runtime library, &lt;a href="https://www.npmjs.com/package/@architect/functions" rel="noopener noreferrer"&gt;Architect Functions&lt;/a&gt; – which this example already does.)&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/http/post-my_event/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;As we just mentioned, the recommended (and easiest) way to work with events is the &lt;a href="https://www.npmjs.com/package/@architect/functions" rel="noopener noreferrer"&gt;Architect Functions&lt;/a&gt;. In this project, our HTTP &lt;code&gt;post /my-event&lt;/code&gt; uses Architect Functions to publishing to the &lt;code&gt;my-event&lt;/code&gt; event.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;app.arc&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your &lt;code&gt;app.arc&lt;/code&gt; file is where you will provision new events and functions.&lt;/p&gt;

&lt;p&gt;Infrastructure-as-code is the practice of provisioning and maintaining cloud infrastructure using a declarative manifest file. It’s like package.json, except for cloud resources like API Gateway, Lambda, and DynamoDB (all of which Begin apps use).&lt;/p&gt;

&lt;p&gt;By checking in your Begin app’s project manifest (&lt;code&gt;app.arc&lt;/code&gt;) file with your code, you can ensure you have exactly the cloud resources your code depends on. This is crucial for ensuring reproducibility and improving iteration speed.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/event-functions/provisioning" rel="noopener noreferrer"&gt;provisioning and working with event functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  How events work in this app
&lt;/h2&gt;

&lt;p&gt;This app is designed to demonstrate the power of event functions and Begin data. Each button is wire to an event publisher that increments a counter in the backend when clicked. Let's see what this looks like in code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3djwp4nr7c8wvavaavmy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3djwp4nr7c8wvavaavmy.jpg" alt="begin-events"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This is our event publisher:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/http/post-my_event/index.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;http&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my-event&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;helpers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;302&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you click on one of the three buttons, it posts to the &lt;code&gt;post /my-event&lt;/code&gt; endpoint above, which in turn publishes an event to the &lt;code&gt;my-event&lt;/code&gt; event subscriber.&lt;/p&gt;

&lt;p&gt;Our subscriber holds updates an atomic counter whenever it receives a new event; to do this we have a table named &lt;code&gt;interactions&lt;/code&gt; with key of &lt;code&gt;clicks&lt;/code&gt;, which we'll increment with each invocation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx6g2vxjhqqh44p4qrru3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx6g2vxjhqqh44p4qrru3.jpg" alt="begin-events-2"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/events/my-event/index.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@architect/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@begin/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;table&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;interactions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;clicks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;myEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="nx"&gt;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;prop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myEvent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it, you’re done! Now you have an infinitely scalable pub / sub message bus at your disposal, meaning your application can respond quickly to user requests, and handle complex background tasks asynchronously.&lt;/p&gt;

&lt;p&gt;Our goal at Begin is to unlock the full power of modern application architectures with minimal effort and complexity. With Begin event functions, the potential capabilities of your apps just grew enormously!&lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent.&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version" rel="noopener noreferrer"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You now have a good idea of how event functions work within Begin. Your next task is to learn &lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Begin Data!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20event%20functions%20app%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE" rel="noopener noreferrer"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference" rel="noopener noreferrer"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data" rel="noopener noreferrer"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions" rel="noopener noreferrer"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues" rel="noopener noreferrer"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Begin HTTP functions</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 06:50:55 +0000</pubDate>
      <link>https://forem.com/begin/begin-http-functions-374a</link>
      <guid>https://forem.com/begin/begin-http-functions-374a</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This tutorial is an introductory walkthrough on creating HTTP Functions with Begin. It should take less than 10 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Getting started with Begin HTTP functions should take just a few minutes, but lay the groundwork for creating your own APIs.  In this article, you will learn how to provision a new function and then fetch JSON data from it to display in your app's frontend. This will be a great introduction to what goes in an HTTP function and how to use them to deliver data to your apps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You will need to have &lt;strong&gt;git&lt;/strong&gt; and &lt;strong&gt;Node.js&lt;/strong&gt; installed to your local computer to follow along with this tutorial. (Learn more about &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"&gt;installing git&lt;/a&gt; and &lt;a href="https://nodejs.org/en/download/"&gt;installing Node.js&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;You'll also need a GitHub account. (Learn more about &lt;a href="https://help.github.com/en/github/getting-started-with-github/signing-up-for-github"&gt;signing up with GitHub&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This tutorial also assumes some familiarity with such things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editors&lt;/li&gt;
&lt;li&gt;Terminal / CLI&lt;/li&gt;
&lt;li&gt;Git and version control&lt;/li&gt;
&lt;li&gt;General software development using JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to be an expert in any of these things in order to follow along though.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;First, click the &lt;strong&gt;Deploy to Begin&lt;/strong&gt; button below. This starts the process of authorizing Begin with your GitHub account. (You may be prompted to log into GitHub, and/or be asked to create a Begin username.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://begin.com/apps/create?template=https://github.com/begin-examples/node-minimal"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yYw27_-V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.begin.com/deploy-to-begin.svg" alt="Deploy to Begin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Name your app &amp;amp; repo
&lt;/h3&gt;

&lt;p&gt;You'll then be prompted to name your new app and repository – this is optional, feel free to use the default app and repo name if you like!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: your Begin app name and repository name cannot be changed later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rsXnpBYx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ia41i6ooyjl4ewz3jz7z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rsXnpBYx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ia41i6ooyjl4ewz3jz7z.jpg" alt="begin-repo-name"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you've clicked the &lt;code&gt;Create...&lt;/code&gt; button, Begin will spin up your new project on GitHub (under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions from this screen (or later from the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;After creating your app, you'll be taken to its &lt;code&gt;Activity&lt;/code&gt; stream. Welcome to the main backend interface of your Begin app!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zwOfbIDz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9t88cpv0t9tp17s2cgwd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zwOfbIDz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9t88cpv0t9tp17s2cgwd.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;From the &lt;code&gt;Activity&lt;/code&gt; view, you'll be able to watch your app build &amp;amp; deploy in real-time. Any time you push to &lt;code&gt;master&lt;/code&gt;, you'll see a new build get kicked off in Begin.&lt;/p&gt;

&lt;p&gt;Each build undergoes a number of predefined build steps (learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys#configuring-build-steps"&gt;build steps here&lt;/a&gt;); these build steps may install your app's dependencies (&lt;code&gt;install&lt;/code&gt;), test your code's syntax (&lt;code&gt;lint&lt;/code&gt;), generate any files or assets needed to run your app (&lt;code&gt;build&lt;/code&gt;), and/or run an automated test suite (&lt;code&gt;test&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If no build steps fail, then the build containing your latest commit to &lt;code&gt;master&lt;/code&gt; is automatically deployed to your &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;Go ahead and click the &lt;strong&gt;Staging&lt;/strong&gt; link in the upper left corner of your left nav to open your new app's &lt;code&gt;staging&lt;/code&gt; URL. You should now see your new app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iNGxgdSH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w819ztenxy3zyjsv87yi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iNGxgdSH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w819ztenxy3zyjsv87yi.jpg" alt="begin-hello-world"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys"&gt;covers build pipelines, git tagging, and more&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Get set up locally
&lt;/h2&gt;

&lt;p&gt;Next let's get your new site running in your local environment (i.e. the computer you work on).&lt;/p&gt;

&lt;p&gt;First, head to your GitHub repo (from the first card in your &lt;code&gt;Activity&lt;/code&gt;, or from the left nav). Find the &lt;strong&gt;clone or download&lt;/strong&gt; button and copy the git URL.&lt;/p&gt;

&lt;p&gt;Then head to your terminal and clone your repo to your local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/your-github-username/your-new-begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got your project cloned on your local machine, &lt;code&gt;cd&lt;/code&gt; into the project directory and install your dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-new-begin-app
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are all set to work on your app locally!&lt;/p&gt;




&lt;h2&gt;
  
  
  Add an HTTP function
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Provisioning an HTTP Function&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a new route in five easy steps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make sure you are in your project's folder on your computer&lt;/li&gt;
&lt;li&gt;Open the &lt;code&gt;app.arc&lt;/code&gt; file in the root of your project&lt;/li&gt;
&lt;li&gt;Find (or add) the &lt;code&gt;@http&lt;/code&gt; pragma, and on a new line, add a route ( &lt;code&gt;get /api&lt;/code&gt; )&lt;/li&gt;
&lt;li&gt;Start the local dev environment (&lt;code&gt;npm start&lt;/code&gt;) to generate any new HTTP Function handlers&lt;/li&gt;
&lt;li&gt;Push your changes!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your new route will automatically deploy to &lt;code&gt;staging&lt;/code&gt;.&lt;br&gt;
If you are happy with &lt;code&gt;staging&lt;/code&gt; you can click the "Deploy to Production" button to see it live on your production environment.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For more in-depth instructions on how to provision new HTTP functions, you can &lt;a href="https://docs.begin.com/en/http-functions/provisioning"&gt;checkout our docs here&lt;/a&gt; or this &lt;a href="https://blog.begin.com/new-at-begin-add-and-manage-routes-via-manifest-file-24ced2e65a36"&gt;article on our blog&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Writing HTTP functions
&lt;/h2&gt;

&lt;p&gt;We must first understand the anatomy of an HTTP function to be able to write them for our specific use cases. All basic HTTP functions consist of one handler function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;REQUEST OBJECT: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HTTP functions are invoked when you navigate to a URL in your app. This &lt;code&gt;get /api&lt;/code&gt; function we just generated by running &lt;code&gt;npm start&lt;/code&gt; is called when we navigate our browser to &lt;code&gt;localhost:3333/api&lt;/code&gt;. These HTTP functions are passed a &lt;code&gt;request object&lt;/code&gt; or &lt;code&gt;req&lt;/code&gt; which contains information about the request to this function. Any data we return from this function is available to our app running in the browser, all we need to do now is request it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;💡 Learn more!&lt;/strong&gt; To learn more about HTTP functions by reading this &lt;a href="https://arc.codes/docs/en/reference/app.arc/http"&gt;article from the Architect docs.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live on &lt;code&gt;staging&lt;/code&gt; and running locally, let's take a quick look into how the project itself is structured so you'll know your way around. Here are the key folders and files in the source tree of your new app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
│   ├── index.html
│   └── index.js
├── src/
│   └── http/
│        └── get-api/
└── app.arc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;public/index.html&lt;/code&gt; &amp;amp; &lt;code&gt;public/index.js&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;public/index.html&lt;/code&gt; is the page served to the browser. This is where our JSON data will be appended to a DOM element of our choosing. &lt;code&gt;public/index.js&lt;/code&gt; is where we will write our function that fetches the JSON data from &lt;code&gt;get /api&lt;/code&gt; and displays it in our HTML page.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;src/http/get-api/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your app utilizes this built-in small, fast, individually executing cloud function that handles HTTP API requests and responses. (We call those HTTP functions, for short.)&lt;/p&gt;

&lt;p&gt;The HTTP function that handles requests to &lt;code&gt;get /api&lt;/code&gt; is found in &lt;code&gt;src/http/get-api/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the next section, we will go more in-depth about how to fetch data from an HTTP Function.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;app.arc&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Your &lt;code&gt;app.arc&lt;/code&gt; file is where you will provision new routes and functions.&lt;/p&gt;

&lt;p&gt;Infrastructure-as-code is the practice of provisioning and maintaining cloud infrastructure using a declarative manifest file. It’s like package.json, except for cloud resources like API Gateway, Lambda, and DynamoDB (all of which Begin apps use).&lt;/p&gt;

&lt;p&gt;By checking in your Begin app’s project manifest (&lt;code&gt;app.arc&lt;/code&gt;) file with your code, you can ensure you have exactly the cloud resources your code depends on. This is crucial for ensuring reproducibility and improving iteration speed.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Learn more!&lt;/strong&gt; Head here to dig deeper into &lt;a href="https://docs.begin.com/en/http-functions/provisioning"&gt;provisioning and working with HTTP functions in Begin apps&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Fetching data from HTTP functions
&lt;/h2&gt;

&lt;p&gt;Earlier we provisioned a new function called &lt;code&gt;get /api&lt;/code&gt;. We will use this function to create an API that sends out a JSON object with a key:value pair of &lt;code&gt;message: Hello from your Begin API!&lt;/code&gt;. Navigate to &lt;code&gt;src/http/get-api/index.js&lt;/code&gt; and copy &amp;amp; paste the code below. Now you can fetch data from this function from anywhere inside of your app!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/http/get-api/index.js&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Begin API called&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json; charset=utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache-control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-cache, no-store, must-revalidate, max-age=0, s-maxage=0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello from your Begin API!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now navigate to &lt;code&gt;localhost:3333/api&lt;/code&gt; to see your message being returned from you new API!&lt;/p&gt;

&lt;p&gt;Now let's fetch this JSON data from our API and display it in our HTML page. First navigate to the root of your app and then open the &lt;code&gt;public/index.html&lt;/code&gt; directory. Find the section below and add this &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; element with an id of #myData:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--public/index.html --&amp;gt;&lt;/span&gt;

 &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"margin-bottom: 8px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        View documentation at:
      &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"link"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://docs.begin.com"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;https://docs.begin.com&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"myData"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...Testing&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;  &lt;span class="c"&gt;&amp;lt;!-- Add this line.--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open the &lt;code&gt;public/index.js&lt;/code&gt; file and replace it's contents to use this function. This async function will fetch the JSON data from our API, the &lt;code&gt;get /api&lt;/code&gt; function we provisioned earlier and then append it to the DOM.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// public/index.js&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Get a reference to the element to display our data in&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;myData&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;// Declare a message variable to be set later&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Attempt to fetch data from our API&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// If there was an error catch it and display the message&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// If we created the display element and added the ID correctly&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Show the message&lt;/span&gt;
    &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can see the data from our &lt;code&gt;get /api&lt;/code&gt; HTTP Function is being requested by our frontend code via fetch then displayed on our HTML page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sN4grLzo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97l7x2q3shc1wb1wacch.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sN4grLzo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97l7x2q3shc1wb1wacch.jpg" alt="begin-hello-world-api"&gt;&lt;/a&gt; &lt;/p&gt;




&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;While not required, it's always a good idea to lint and run tests before pushing just to make sure you catch any errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint
npm &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Now let's push this commit (and deploy the build to &lt;code&gt;staging&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nt"&gt;-A&lt;/span&gt;
git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s1"&gt;'Just customizing my Begin site!'&lt;/span&gt;
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head on back to Begin and open your &lt;code&gt;staging&lt;/code&gt; URL once your build is complete. Looking good? Excellent.&lt;/p&gt;

&lt;p&gt;Now let's deploy to &lt;code&gt;production&lt;/code&gt;: click the &lt;strong&gt;Deploy to production&lt;/strong&gt; button in the upper left, pick a version, leave an optional message summarizing your changes, and &lt;strong&gt;Ship it&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;When your next build is done, click the &lt;code&gt;production&lt;/code&gt; link in the upper left corner to see the latest release of your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;✨Tip:&lt;/strong&gt; You can also deploy to production from your terminal by bumping your &lt;a href="https://docs.npmjs.com/cli/version"&gt;npm version&lt;/a&gt; (&lt;code&gt;npm version [patch|minor|major] &amp;amp;&amp;amp; git push origin&lt;/code&gt;) or by cutting a git tag (&lt;code&gt;git tag -a 1.0.0 -m "1.0, here we come" &amp;amp;&amp;amp; git push origin --tags&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You now have a good idea on how HTTP functions work within Begin. Your next task is to learn &lt;a href="https://docs.begin.com/en/data/begin-data"&gt;Begin Data!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go &lt;a href="https://twitter.com/intent/tweet?text=Hey%2C%20check%20out%20my%20new%20HTTP%20functions%20app%21%20%28I%20made%20it%20with%20@Begin%29%20PASTE_YOUR_URL_HERE"&gt;show it off&lt;/a&gt; – people need to see this thing!&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expand the capabilities of your app:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/http-functions/api-reference"&gt;Creating new routes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/data/begin-data"&gt;Add Begin Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/getting-started/introduction"&gt;Begin reference docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Get help:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/smallwins/begin-community/discussions"&gt;Begin community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/beginner-corp/begin-community/issues"&gt;Issue tracker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Begin Quickstart</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Thu, 08 Apr 2021 04:35:01 +0000</pubDate>
      <link>https://forem.com/begin/begin-quickstart-14l0</link>
      <guid>https://forem.com/begin/begin-quickstart-14l0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⏱ This guide should require less than 5 minutes&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Getting started building with Begin is remarkably fast and simple.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Once you're finished with this guide, you'll be ready to build and scale just about any kind of web application, API, or site with speed, ease, and grace.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, let's review what you need to get going.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;While this guide assumes general familiarity with such things as text editors, terminal interfaces, git, and basic software development in JS with Node.js, you do not need to be a CTO to use Begin (or this guide)!&lt;/p&gt;

&lt;h3&gt;
  
  
  tl;dr, you'll need:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A (free) GitHub account&lt;/li&gt;
&lt;li&gt;Any computer running macOS, Windows, or Linux, with:

&lt;ul&gt;
&lt;li&gt;Node.js 12&lt;/li&gt;
&lt;li&gt;npm 6.x&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Platforms: macOS, Windows, and Linux
&lt;/h3&gt;

&lt;p&gt;Begin supports local, offline development on just about all modern computers, including: macOS, Windows (10+), and Linux.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runtimes: Node.js 12
&lt;/h3&gt;

&lt;p&gt;Begin provisions and manages AWS infrastructure that runs solely on Node.js 12 (with support additional runtimes coming soon).&lt;/p&gt;

&lt;p&gt;You can work locally with versions of Node other than 12, but your app shouldn't depend on any features, functionality, or fixes that are not available in Node 12.&lt;/p&gt;

&lt;p&gt;You can grab &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;Node.js here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Package management: NPM 6.x
&lt;/h3&gt;

&lt;p&gt;Begin requires npm 6.x for local development. Recent releases of Node bundle npm 5.x, so you'll want to make sure to upgrade with: &lt;code&gt;npm install npm@latest -g&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Version control: GitHub
&lt;/h3&gt;

&lt;p&gt;Begin hosts project repos on GitHub; if you don't have one already, &lt;a href="https://github.com/join" rel="noopener noreferrer"&gt;sign up for a free GitHub account here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When you create a new app, Begin will provision your GitHub repo pre-wired with the integrations it needs, such as webhooks to Begin's CI.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Begin only requests the least-privileged set of permissions required to work with GitHub, and does not attempt to access any other repositories or personal data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Create a Begin account
&lt;/h2&gt;

&lt;p&gt;To create a Begin account, simply click the &lt;code&gt;Login&lt;/code&gt; button on the &lt;a href="https://begin.com" rel="noopener noreferrer"&gt;Begin home page&lt;/a&gt;, authorize it with GitHub, and pick a username. That's it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an app
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ill5tx76gah7js7xe9h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ill5tx76gah7js7xe9h.jpg" alt="begin-app-create-selection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating your Begin account, select an app from the list of starter apps to build from. (We think the &lt;code&gt;Personal website&lt;/code&gt; is a great place to start, but this guide applies to all Begin apps.)&lt;/p&gt;

&lt;p&gt;Then name your app and repo, and Begin will spin up your new project repository under &lt;code&gt;github.com/{your GH username}/{your repo name}&lt;/code&gt;, and populate it with a fully functional Begin app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default your Begin app repo is created as a public GitHub repo; it can be set to private by granting Begin additional permissions via in the &lt;code&gt;Settings&lt;/code&gt; screen found in the left nav of your Begin app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Your first deploy
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqdcuue7x8cwy300ej9n5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqdcuue7x8cwy300ej9n5.jpg" alt="begin-activity"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Immediately after Begin is finished setting up your project repo, it will kick off its first deploy to your app's &lt;code&gt;staging&lt;/code&gt; environment.&lt;/p&gt;

&lt;p&gt;By default, each commit to &lt;code&gt;master&lt;/code&gt; initiates a build; if the build is green, that build is immediately deployed to your app's &lt;code&gt;staging&lt;/code&gt; environment. No fuss, no muss!&lt;/p&gt;

&lt;p&gt;Every new build to &lt;code&gt;staging&lt;/code&gt; and &lt;code&gt;master&lt;/code&gt; appears in your &lt;strong&gt;Activity&lt;/strong&gt; feed.&lt;/p&gt;

&lt;p&gt;Learn more about &lt;a href="https://docs.begin.com/en/getting-started/builds-deploys" rel="noopener noreferrer"&gt;building &amp;amp; deploying with Begin&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessing your live app
&lt;/h2&gt;

&lt;p&gt;Once deployed, your app will be immediately live and available on the internets. Nice! 🎉&lt;/p&gt;

&lt;p&gt;To access your &lt;code&gt;staging&lt;/code&gt; environment, click &lt;code&gt;Staging&lt;/code&gt; link in the build status module in the top of the left navbar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;Now that your app is live in &lt;code&gt;staging&lt;/code&gt;, a brief word about how Begin apps are structured so you'll know your way around.&lt;/p&gt;

&lt;p&gt;Begin applications are comprised of many small, fast, individually executing cloud functions (or Functions, for short). Let's take a quick look at the source tree of a basic Begin app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
├── public/
├── src/
│   ├── http/
│   │   └── get-index/
│   ├── shared/
│   └── views/
└── &lt;span class="nb"&gt;test&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app's many small, fast, isolated Functions are organized in your project under &lt;code&gt;src/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Each HTTP Function directory services a handler for a publicly available HTTP route (e.g. &lt;code&gt;src/http/get-hello-world&lt;/code&gt; services &lt;code&gt;GET /hello/world&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;So if you want to make a change to your app's root view, you'll want to modify its &lt;code&gt;src/http/get-index/index.js&lt;/code&gt; file.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Learn more about &lt;a href="https://docs.begin.com/en/getting-started/project-structure" rel="noopener noreferrer"&gt;Begin app project structure&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Working locally
&lt;/h2&gt;

&lt;p&gt;Get started working locally on your app in five easy steps. Assuming you used the default name of &lt;code&gt;Begin app&lt;/code&gt;, open your terminal app, and:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone your app's repo to your local machine:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/&lt;span class="o"&gt;{&lt;/span&gt;your GH username&lt;span class="o"&gt;}&lt;/span&gt;/begin-app.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cd&lt;/code&gt; to your Begin project directory:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;begin-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Install npm packages:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Start the app locally:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Learn more about &lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;getting set up in our Introduction&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  That's it!
&lt;/h2&gt;

&lt;p&gt;In just a few minutes, you now have a fresh app with dedicated &lt;code&gt;staging&lt;/code&gt; and &lt;code&gt;production&lt;/code&gt; environments, a fast local, offline dev environment, pre-wired CI/CD, and everything you need to rapidly iterate.&lt;/p&gt;

&lt;p&gt;Happy building!&lt;/p&gt;

&lt;h2&gt;
  
  
  Ship to &lt;code&gt;production&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Lint and run tests, of course:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run lint &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Release to &lt;code&gt;production&lt;/code&gt; by:

&lt;ul&gt;
&lt;li&gt;Using the &lt;code&gt;Deploy to Production&lt;/code&gt; button in the left nav in Begin, or&lt;/li&gt;
&lt;li&gt;Creating a &lt;a href="https://git-scm.com/book/en/v2/Git-Basics-Tagging" rel="noopener noreferrer"&gt;git tag&lt;/a&gt;, i.e.:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git tag &lt;span class="nt"&gt;-a&lt;/span&gt; 1.0.1 &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"This release includes 20% more cowbell"&lt;/span&gt;
git push origin 1.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Or also by cutting a &lt;a href="https://help.github.com/articles/creating-releases/" rel="noopener noreferrer"&gt;GitHub Release&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;👓 Note: We strongly encourage the use of &lt;a href="https://semver.org/" rel="noopener noreferrer"&gt;SemVer&lt;/a&gt; when creating &lt;code&gt;production&lt;/code&gt; releases!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Keep learning
&lt;/h3&gt;

&lt;p&gt;There are many fun things to learn about building Begin apps, &lt;a href="https://docs.begin.com/en/getting-started/introduction" rel="noopener noreferrer"&gt;check out the rest of our docs here!&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Configure AWS Lambda source paths with OpenJS Architect</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Tue, 16 Mar 2021 09:04:49 +0000</pubDate>
      <link>https://forem.com/begin/configurable-file-paths-verbose-format-22m8</link>
      <guid>https://forem.com/begin/configurable-file-paths-verbose-format-22m8</guid>
      <description>&lt;p&gt;Architect originally relied on convention over configuration — meaning you could expect the placement of Lambda function handlers, to appear in default and deterministic locations. Recently, we introduced configurable file paths, which allow you to have more granular configurability over your Architect and Begin projects source code. This might be important for you because you have an existing project structure and conventions or you may need to point your Lambdas at generated build artifacts from something like TypeScript.&lt;/p&gt;

&lt;p&gt;Configure source for &lt;code&gt;get /&lt;/code&gt;  in &lt;code&gt;package.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Define the application Infra as Code (IaC) in &lt;code&gt;package.json&lt;/code&gt;  under the &lt;code&gt;arc&lt;/code&gt; key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"arc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"app"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"begin-app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"get"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"path/to/code"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure source for a larger app in &lt;code&gt;package.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Define IaC for a GraphQL app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"arc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"get"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"path/to/code"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"/api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"post"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"path/to/apollo"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This enables you to configure separate source paths for your code for each Lambda function. It is a good idea to separate your code into single responsibility functions. Less code per function means faster cold-starts and deployments. This also makes sharing code and using transpilers a breeze!&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Let's make a new Begin app!</title>
      <dc:creator>SHAWNHOSEA</dc:creator>
      <pubDate>Wed, 10 Mar 2021 08:52:11 +0000</pubDate>
      <link>https://forem.com/begin/let-s-make-a-new-begin-app-a3i</link>
      <guid>https://forem.com/begin/let-s-make-a-new-begin-app-a3i</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;There are various ways to spin up a new app on Begin. You have the option to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose between Node or Deno for your runtime&lt;/li&gt;
&lt;li&gt;Start with a framework-specific starter app&lt;/li&gt;
&lt;li&gt;Use one of our example apps&lt;/li&gt;
&lt;li&gt;Port one of your apps over to Begin by using an existing repo&lt;/li&gt;
&lt;li&gt;Clone an existing repo from someone else&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Choose a runtime:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C8KxMlYr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrf3kzje1gprrel4plw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C8KxMlYr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrf3kzje1gprrel4plw2.png" alt="Screen Shot 2021-03-10 at 3.02.03 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You have the option to choose between Node or Deno for your runtime. With Node, you can use one of the framework-specific starter apps or a Begin example app. Deno only has the Begin example apps available. Both runtimes allow you to port an outside repository to get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Framework-specific starter apps
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MaooTUrJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ulbcv4l49xl91gethxcj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MaooTUrJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ulbcv4l49xl91gethxcj.png" alt="Screen Shot 2021-03-10 at 3.03.07 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have four different framework-specific starter apps to choose from. Each of these starter apps comes with an accompanying guide to help get you going. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/apollo-graphql"&gt;Apollo GraphQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/create-react-app"&gt;React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/svelte"&gt;Svelte&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/vue"&gt;Vue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EAPYSi2A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvneabn3wnlv815rk13c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EAPYSi2A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvneabn3wnlv815rk13c.png" alt="Screen Shot 2021-03-10 at 3.05.46 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view them all &lt;a href="https://docs.begin.com/en/guides"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example apps
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kVWGXpo3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6k15x6nrl72flzit9tl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kVWGXpo3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6k15x6nrl72flzit9tl.png" alt="Screen Shot 2021-03-10 at 3.19.52 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Six different example apps cover a particular feature or use-case that's possible with Begin. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/quickstart"&gt;Minimal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/http-functions"&gt;Hello world with a basic HTTP function&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/personal-website"&gt;Personal website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/crud-app"&gt;Basic CRUD app&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/events"&gt;Events click tracker app&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.begin.com/en/guides/scheduled"&gt;Scheduled functions hit counter app&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These example apps come with accompanying guides as well to help get you started. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rmf4yh5Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5e2fmja8fls6ya0u0fto.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rmf4yh5Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5e2fmja8fls6ya0u0fto.png" alt="Screen Shot 2021-03-10 at 3.23.41 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view them all &lt;a href="https://docs.begin.com/en/guides"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use your own
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R0I4UvP0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i21xd33loziu9e3psoe9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R0I4UvP0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i21xd33loziu9e3psoe9.png" alt="Screen Shot 2021-03-10 at 3.39.56 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use an existing repo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yzqpkhER--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dn60l4i7fwwhxqy7v9n0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yzqpkhER--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dn60l4i7fwwhxqy7v9n0.png" alt="Screen Shot 2021-03-10 at 3.47.01 AM"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;You have the option to port one of your apps over to Begin by using an existing repo. &lt;code&gt;Use an existing repo&lt;/code&gt; will add the minimum necessary files to use Begin with an existing GitHub repo.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clone an app
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xwn1TFn3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3zitqtnk6o3414qran1y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xwn1TFn3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3zitqtnk6o3414qran1y.png" alt="Screen Shot 2021-03-10 at 3.45.10 AM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cloning an app will allow you to clone an existing Begin or Architect app into a fresh GitHub repo. &lt;/p&gt;

</description>
      <category>serverless</category>
      <category>cloud</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
