netlify-functions-workshop

by DavidWells

Netlify Serverless Functions Workshop

164 Stars 40 Forks Last release: Not found 35 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Netlify Functions Serverless Workshop

This repo will teach you the core concepts of using serverless functions with Netlify.

Table of Contents

Using this repo

After following the prerequisite setup steps, work from the lessons folders.

If you get stuck or want to look ahead checkout the lessons-code-complete directory for the completed code.

Repo directory structure:

|── /lessons                 ✅ Work from these files!
|── /lessons-code-complete   💡 Complete lesson answers
|── /_instructor             🙈 Ignore these files. For instructor updates
|── /_scripts                🙈 Ignore these files

Workshop Lessons

Core Concepts

| Lesson | Final Code | |:--------------------------- |:-----| | 1 Hello World
Deploying Your First Endpoint | Complete Code | | 2 Dynamic Content
Rendering Dynamic Content | Complete Code | | 3 Using Environment Variables
Using environment variables | Complete Code | | 4 Using Dependancies
Using NPM dependencies | Complete Code | | 5 Authenication
Protecting Endpoints | Complete Code | | 6 Using A Database
Using a database | Complete Code | | 7 Using Middleware
Using Function middleware | Complete Code | | 8 Using Addons
Deploying Your First Endpoint | Complete Code | | 9 Using Cors
Adding CORS support | Complete Code | | 10 Testing Functions
Testing Serverless functions | Complete Code |

Use Cases

| Lesson | Final Code | |:--------------------------- |:-----| | 1 Rest Api
Using functions for REST APIs | Complete Code | | 2 Graphql
Using functions for GraphQL APIs | Complete Code | | 3 Redirects
Using functions for Dynamic Redirects | Complete Code | | 4 Setting Cookies
Using functions to set cookies | Complete Code | | 5 Fetching Data
Using functions to fetch external API data | Complete Code | | 6 Scraping
Using functions for web scraping | Complete Code | | 7 Sending Emails
Using functions for sending email | Complete Code | | 8 Sending Sms
Using functions for sending text messages | Complete Code | | 9 Event Driven Functions
Using Netlify Event Driven functions | Complete Code | | 10 Payment Processing
Using functions for Payment Processing | Complete Code | | 11 Handling Oauth
Handing OAuth Flows | Complete Code | | 12 Handling File Uploads
Using functions for uploading files | Complete Code | | 13 Returning Dynamic Images
Using functions for returning images | Complete Code |

Helpful Tools

  • Postman - desktop app for quick & easy endpoint testing
  • NVM - Node version manager

Prerequisites & Setup Steps

  1. Install the latest LTS version of Node. How to install Node.
  2. Verify you have git on your machine

    Most machines come pre-loaded with git. 🎉

    To verify you have

    git
    , open up your terminal and run:
    which git
    

    This should return a path of where git is installed. If the command returns

    git not found
    , we will need to install git on your machine.
  3. Setup a Netlify account

    If you don't already have an Netlify account, let's get one setup.

    Click here to setup a free Netlify account

  4. Install Netlify CLI

    Open up your terminal and run:

    npm install netlify-cli -g
    
  5. Connect the Netlify CLI with your Netlify account

    Open up your terminal and run:

    netlify login
    
  6. Verify the Netlify CLI works on your machine

    Open up your terminal and run:

    netlify --help
    

    This should return the list of commands from the CLI tool.

Bonus setup:

  • Install postman for quick & easy testing of endpoints we deploy
  • It's also recommended that you use nvm (node version manager) just in case you need to change versions of node for the workshop.

Additional Learning materials

Netlify

Serverless

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.