All Articles

Create Your Own Quote API with Netlify Functions - Part 2

This is a 3 part exercise on how to create and use your own quote API with Netlify functions.

Part 1: Get a Netlify function up and running locally.
Part 2: Deploy the function to the Netlify platform.
Part 3: Tie it all together by using the deployed API to display quotes in a React app.

If you have been following along from Part 1, push your random-quotes project to your git hosting provider. I’m using GitHub, but other providers such as GitLab or BitBucket will work as well.

  1. Install the Netlify app on GitHub
  2. Sign up for a Netlify account.
  3. Once you’re logged in, click on the New site from git button.
  4. Click on the GitHub button
  5. Authorize Netlify to have access to your GitHub account
  6. Search for and select the random-quotes repository.
  7. Fill in the following:
    Build command: yarn build.
    Publish directory: build.
  8. Click on Deploy site

Once the deploy is finish, you should see a unique Netlify URL that looks something like this: https://gracious-jones-94f7bb.netlify.app

Test your deployed API by navigating to: https://gracious-jones-94f7bb.netlify.app/.netlify/functions/quotes

If you see a quote, congratulations! You’ve deployed your first Netlify Function with usable quote API!

NOTE: Your exact URL will be unique to you.

In the next and final section, we will use this API to display a quote in our React app.

Published Jun 30, 2020

I love coffee, coding and writing.