This is the source code for a Frontend Masters course with Jason Lengstorf about serverless functions.
Live site! https://frontendmasters-serverless.netlify.app/
- What does “serverless” mean?
- How to load data using serverless functions
- How to protect private credentials in front-end applications
- How to send data to serverless functions
- How to save data sent to serverless functions
- How to limit access to serverless functions
Node version: v12.12.0
# currently v2.58.0
npm install -g netlify-cli@latest
# or use HTTPS if you have issues cloning
git clone --branch start https://github.com/jlengstorf/frontendmasters-serverless.git
Save all of these in .env
:
OMDB_API_KEY
— get this from https://omdbapi.com/HASURA_API_URL
— get this from https://hasura.io/HASURA_ADMIN_SECRET
— get this from https://hasura.io/
Make sure to install dotenv npm install dotenv
and add require("dotenv").config()
to each file that uses one of the environment variables.
-
Create a Hasura account, and link it to a Heroku account.
-
Go to Settings on your Heroku account, and add config vars HASURA_ADMIN_SECRET and HASURA_GRAPHQL_ADMIN_SECRET.
-
On Hasura, once you create a new project, add a new env var, Admin Secret, by clicking on New Env Var, and name it Admin Secret.
-
Launch the Hasura console and make sure that your GraphQL endpoint is no longer public.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.