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

Instructions

  1. In a new project, create a hello.js function in a functions directory with this sample code:

    exports.handler = async function(event, context) {
    return {
    statusCode: 200,
    body: JSON.stringify({message: "Hello World"})
    };
    }
  2. 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.

  3. Push this project to a new GH repo.

  4. Create a new App in your Netlify team and deploy the repo you just created.

  5. 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

Spoilers


Lab Time

  • Assignments
  • Final Presentation

Prep

Netlify serverless functions

Instagram API