Build a Serverless Function with Netlify Example
This project is the source code for the blog post "Build and Deploy Secure Serverless Functions with Netlify." A complete walkthrough video is also available on YouTube.
Requirements
- Node.js version 12 or higher
- A free Netlify account
- A free Okta developer account
- A good code editor, such as Visual Studio Code
Setup
The complete steps are explained in the blog post or video.
- Clone or download this source code
- Open your terminal/command prompt, change to the project folder, and install dependencies using
npm install
- Copy the
.env.sample
file to.env
- Create a new "Single-Page Application" in the Okta Developer dashboard
- Copy your application's Client ID and Org URL to the
.env
file - Edit
client/index.js
and change theoktaOrgUrl
andoktaClientId
values to match your Okta Org URL and Client ID - Build the project from the command line using
npm run build
Running locally
npx netlify-cli dev
Note: You can also install the
netlify-cli
tool locally usingnpm install --save-dev netlify-cli
or globally usingnpm install -g netlify-cli
. After installing locally, you can usenpx netlify dev
or globally you can usenetlify dev
.