A simple template to create and deploy Netlify Functions with ease.
This repo requires netlify-cli to be installed globally:
npm install -g netlify-cli
-
Clone and install:
git clone git@github.com:pie-inc/netlify-functions-template.git <preferred-directory> cd <preferred-directory> npm install
-
Create a function: An example Hello World function is provided to help development
-
Run locally:
npm run dev
Visit
http://localhost:8888/hello
The netlify.toml file redirects all paths to matching functions:
[[redirects]]
from = "/*"
to = "/.netlify/functions/:splat"
status = 200So /api calls functions/api.js, /users calls functions/users.js, etc.