Companion repository for the tutorial demostrating how to hide secret keys using netlify functions in a Frontend application
Netlify Functions are files used deploy server-side code as API endpoints without the need of backend.
To follow along with this tutorial, basic understanding of RESTful APIs and async/await
is required.
It is recommended to start off from the testing branch.
The final demo app lives in the main
branch: https://netlify-func-demo.netlify.app/
- Clone the repository
git clone https://github.com/frankiefab100/netlify-serverless-functions-demo.git
- Change to netlify-serverless-functions-demo directory
cd netlify-serverless-functions-demo
- Install dependencies
npm install
- Run the app on the server
netlify dev
The project will be ready on localhost:8888 via: https://localhost:8888/.netlify/functions/getPhotos
Note: Add your API keys as Environment variable in .env
: PIXABAY_API_KEY=your-api-key-here
This project is protected under the MIT License.
Check out the blog post: https://www.freecodecamp.org/news/hide-api-keys-in-frontend-apps-using-netlify-functions/
Built with β€οΈ