Skip to content

pie-inc/netlify-functions-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Netlify Functions Template

A simple template to create and deploy Netlify Functions with ease.

Requirements

This repo requires netlify-cli to be installed globally:

npm install -g netlify-cli

Getting started

  1. Clone and install:

    git clone git@github.com:pie-inc/netlify-functions-template.git <preferred-directory>
    cd <preferred-directory>
    npm install
  2. Create a function: An example Hello World function is provided to help development

  3. Run locally:

    npm run dev

    Visit http://localhost:8888/hello

How it works

The netlify.toml file redirects all paths to matching functions:

[[redirects]]
  from = "/*"
  to = "/.netlify/functions/:splat"
  status = 200

So /api calls functions/api.js, /users calls functions/users.js, etc.

About

A simple template to create and deploy Netlify Functions with ease.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published