DSGN 270 Day 7 - Serverless functions and the Instagram API
Housekeeping
- Guest Speaker: Kaje - schedule for Thursday the 9th in the afternoon? Or Wednesday the 8th?
- Ash will be available this afternoon for questions on the 200 group assignment
- Assignment 3 Overview
- Due: Friday, December 3 @ 11:59pm
- 50% of final course mark
1. Netlify Serverless Functions
Materials
- Documentation: Serverless functions overview
- Sample code: hello-netlify-functions
Instructions
-
In a new project, create a
hello.js
function in afunctions
directory with this sample code:exports.handler = async function(event, context) {
return {
statusCode: 200,
body: JSON.stringify({message: "Hello World"})
};
} -
In the root directory, create a
netlify.toml
file with the following code:[functions]
directory = "functions"This tells Netlify which directory to use to load serverless functions.
-
Push this project to a new GH repo.
-
Create a new App in your Netlify team and deploy the repo you just created.
-
Test your hello world serverless function by navigating to:
https://[site-name].netlify.app/.netlify/functions/hello
2. Connecting to the Instagram API
Materials
JAMstack security and connection types
- Are your keys secure on the JAMstack?
- APIs and Authentication on the JAMstack
- Instagram Tutorial: Using the Instagram API + Serverless Netlify to display your own Photos in 2021
Spoilers
Lab Time
- Assignments
- Final Presentation
Prep
Netlify serverless functions
- Documentation: Serverless functions overview
- Videos:
- Create your first Netlify Serverless Function! by Ania Kubów, AND/OR
- Serverless Lambda Functions by Traversy Media (might be a little out of date)
- Local Netlify environment: Netlify Serverless Functions with Netlify Dev by James Q Quick
Instagram API
- Instagram Tutorial: Using the Instagram API + Serverless Netlify to display your own Photos in 2021