An open API service indexing awesome lists of open source software.

https://github.com/davidwells/netlify-functions-workshop

Netlify Serverless Functions Workshop
https://github.com/davidwells/netlify-functions-workshop

functions netlify netlify-functions serverless workshop

Last synced: about 1 month ago
JSON representation

Netlify Serverless Functions Workshop

Awesome Lists containing this project

README

        

# Netlify Functions Serverless Workshop

This repo will teach you the [core concepts of using serverless functions](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts) with Netlify.

## Table of Contents

- [Using this repo](#using-this-repo)
- [Workshop Lessons](#workshop-lessons)
* [Core Concepts](#core-concepts)
* [Use Cases](#use-cases)
- [Helpful Tools](#helpful-tools)
- [Prerequisites & Setup Steps](#prerequisites--setup-steps)
- [Additional Learning materials](#additional-learning-materials)
* [Netlify](#netlify)
* [Serverless](#serverless)

## Using this repo

After following the [prerequisite setup steps](https://github.com/DavidWells/serverless-workshop#prerequisites--setup-steps), work from the [**lessons**](./lessons) folders.

If you get stuck or want to look ahead checkout the [**lessons-code-complete**](./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](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/1-hello-world)
Deploying Your First Endpoint | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/1-hello-world) |
| [2 Dynamic Content](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/2-dynamic-content)
Rendering Dynamic Content | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/2-dynamic-content) |
| [3 Using Environment Variables](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/3-using-environment-variables)
Using environment variables | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/3-using-environment-variables) |
| [4 Using Dependancies](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/4-using-dependancies)
Using NPM dependencies | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/4-using-dependancies) |
| [5 Authenication](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/5-authenication)
Protecting Endpoints | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/5-authenication) |
| [6 Using A Database](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/6-using-a-database)
Using a database | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/6-using-a-database) |
| [7 Using Middleware](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/7-using-middleware)
Using Function middleware | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/7-using-middleware) |
| [8 Using Addons](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/8-using-addons)
Deploying Your First Endpoint | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/8-using-addons) |
| [9 Using Cors](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/9-using-cors)
Adding CORS support | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/9-using-cors) |
| [10 Testing Functions](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/core-concepts/10-testing-functions)
Testing Serverless functions | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/core-concepts/10-testing-functions) |

### Use Cases

| Lesson | Final Code |
|:--------------------------- |:-----|
| [1 Rest Api](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/1-rest-api)
Using functions for REST APIs | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/1-rest-api) |
| [2 Graphql](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/2-graphql)
Using functions for GraphQL APIs | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/2-graphql) |
| [3 Redirects](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/3-redirects)
Using functions for Dynamic Redirects | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/3-redirects) |
| [4 Setting Cookies](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/4-setting-cookies)
Using functions to set cookies | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/4-setting-cookies) |
| [5 Fetching Data](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/5-fetching-data)
Using functions to fetch external API data | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/5-fetching-data) |
| [6 Scraping](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/6-scraping)
Using functions for web scraping | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/6-scraping) |
| [7 Sending Emails](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/7-sending-emails)
Using functions for sending email | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/7-sending-emails) |
| [8 Sending Sms](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/8-sending-sms)
Using functions for sending text messages | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/8-sending-sms) |
| [9 Event Driven Functions](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/9-event-driven-functions)
Using Netlify Event Driven functions | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/9-event-driven-functions) |
| [10 Payment Processing](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/10-payment-processing)
Using functions for Payment Processing | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/10-payment-processing) |
| [11 Handling Oauth](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/11-handling-oauth)
Handing OAuth Flows | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/11-handling-oauth) |
| [12 Handling File Uploads](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/12-handling-file-uploads)
Using functions for uploading files | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/12-handling-file-uploads) |
| [13 Returning Dynamic Images](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons/use-cases/13-returning-dynamic-images)
Using functions for returning images | [Complete Code](https://github.com/DavidWells/netlify-functions-workshop/tree/master/lessons-code-complete/use-cases/13-returning-dynamic-images) |

## Helpful Tools

- [Postman](https://www.getpostman.com/) - desktop app for quick & easy endpoint testing
- [NVM](https://github.com/creationix/nvm) - Node version manager

## Prerequisites & Setup Steps

1. **Install the latest LTS version of [Node](https://nodejs.org/)**. [How to install Node](https://docs.npmjs.com/getting-started/installing-node).
2. **Verify you have [git](https://git-scm.com/downloads) on your machine**

Most machines come pre-loaded with git. 🎉

To verify you have `git`, open up your terminal and run:

```bash
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](http://app.netlify.com)

4. **[Install Netlify CLI](https://cli.netlify.com/)**

Open up your terminal and run:

```bash
npm install netlify-cli -g
```

5. **Connect the Netlify CLI with your Netlify account**. 

Open up your terminal and run:

```bash
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](https://www.getpostman.com/) for quick & easy testing of endpoints we deploy
- It's also recommended that you use [nvm](https://github.com/creationix/nvm) (node version manager) just in case you need to change versions of node for the workshop.

## Additional Learning materials

### Netlify

- [Function Docs](https://www.netlify.com/docs/functions/)
- [Function Examples](https://functions.netlify.com/examples)
- [Function Tutorials](https://functions.netlify.com/tutorials)

### Serverless

- [Applying the Serverless Mindset to Any Tech Stack](https://www.youtube.com/watch?v=8Rzv68K8ZOY)
- [Serverless Architectural Patterns](https://medium.com/@eduardoromero/serverless-architectural-patterns-261d8743020)
- [Serverless Microservice Patterns for AWS](https://www.jeremydaly.com/serverless-microservice-patterns-for-aws/)
- [Production-Ready Serverless](https://www.manning.com/livevideo/production-ready-serverless)
- [Cloud Native Development Patterns & Best Practices](https://www.amazon.com/Cloud-Native-Development-Patterns-Practices/dp/1788473922)
- [JavaScript Cloud Native Development Cookbook](https://www.amazon.com/JavaScript-Cloud-Native-Development-Cookbook/dp/1788470419)
- [Serverless framework workshop](https://github.com/DavidWells/serverless-workshop)