Just a moment
Gradient background

Netlify's serverless functions

Page 2 out of 10

Get a basic introduction to Netlify's serverless functions and prepare your repository for the upcoming code.

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Sunday, 23 October 2022 · Estimated 1 minute read
Modified on Monday, 31 October 2022

Objectives

  1. Get a basic introduction to Netlify's serverless functions.
  2. Create your directory and file structure for upcoming code.

Introduction

Prepare repository

Let's start by creating the Astra DB client and CRUD handler files that we will add code to later on.

bash
Copy
mkdir -p ./netlify/functions
cd ./netlify/functions
touch astraClient.js createTodo.js deleteTodo.js getTodos.js updateTodo.js

Your netlify directory structure should look like this.

bash
Copy
❯ tree netlify -L 2 -la
netlify
└── functions
    ├── astraClient.js
    ├── createTodo.js
    ├── deleteTodo.js
    ├── getTodos.js
    └── updateTodo.js

1 directory, 5 files