Introduction to Serverless Functions

Jason Lengstorf
Learn With Jason
2 hours, 58 minutes CC
Introduction to Serverless Functions

Course Description

​​Serverless functions enable you to build dynamic web experiences without the hassle of setting up or maintaining servers! In this course, you'll learn how to create serverless functions to accomplish a variety of tasks that typically require a back-end. Whether that's securely loading data, processing form entries, handling user access, or doing something totally off the wall, serverless functions let you skip the boilerplate and get straight to building your app's logic!

This course and others like it are available as part of our Frontend Masters video subscription.

Preview
Close

Course Details

Published: August 25, 2020

Learn Straight from the Experts Who Shape the Modern Web

Your Path to Senior Developer and Beyond
  • 200+ In-depth courses
  • 18 Learning Paths
  • Industry Leading Experts
  • Live Interactive Workshops

Table of Contents

Introduction

Section Duration: 16 minutes
  • Introduction
    Jason Lengstorf gives an overview of his background in the industry, explains what led him to start using serverless functions, and adds that serverless functions allow frontend developers to build robust applications with only a minimal amount of server side work.
  • Overview
    Jason gives an overview of the course content, and demonstrates how to clone the course repository, install the Netlify CLI, and run the first application of the course locally.

Serverless Functions

Section Duration: 26 minutes

API Data

Section Duration: 53 minutes
  • Setting up an API Secret
    Jason demonstrates how to generate an API key, how to make a call to a third party API using a secure API token to access the movie database (OMDb), and explains that serverless functions do not expose their code through browser inspection, and are therefore useful when using private API keys.
  • Fetching Data from the OMDb API
    Jason fetches data from the OMDb API using an API key stored in a .env file, and demonstrates how to check that the data is fetched correctly by inspecting the network preview in the browser.
  • Rendering API Data
    Jason fetches and renders movie ratings, or scores, into the UI from the OMDb database and builds a loop to cypher through the various scores for each movie.
  • Getting Set Up with Hasura
    Jason demonstrates how to create a database using a third party application called Hasura Cloud, and explains how to add rows to the database table. Hasura allows developers to create a database in Heroku, and uses GraphQL queries to link the UI to the database.
  • GraphQL Data in Hasura
    Jason creates a GraphQL query on Hasura through the Hasura sandbox, links Hasura and the application using a GraphQL endpoint and a secret key, refactors the code of one of the serverless functions, and uses the query to fetch the data that is later rendered in the application UI.
  • Handling Form POST in a Serverless Function
    Jason continues coding the application started previously by adding a new serverless function that allows the user to add a new element of data from the UI, and demonstrates how to create a mutation on the GraphQL Sandbox in the Hasura application. A GraphQL mutation allows the posting of new data into the database.

Database & Auth

Section Duration: 48 minutes

Use Cases & Q&A

Section Duration: 29 minutes

Wrapping Up

Section Duration: 4 minutes
  • Wrapping Up
    Jason wraps up the course, shares resources to take learning about serverless function further, and explains that for the majority of the work done on the web, there is a possibility to refactor or greenfield code using serverless functions.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Start a 7-Day Free Trial