Hi there! This is a playground repo to test out Netlify’s Lambda Functions. You can see a live demo of the examples at https://netlify-lamda-function.netlify.com.
There are a lambda generating random emoji đź‘Ť at ./src/lambda/emoji.js and random dog photos ./src/lambda/unsplash.js
If you want your own copy to play around with, the quickest way to get it up and running is clicking the Deploy to Netlify button below. It will clone this repository into your own account, and deploy the site to Netlify.
To run the examples locally, here’s what you’ll need:
System Requirements:
- git
- NodeJS 8 or greater
- npm
- Unsplash key
cd
into your local copy of the repository and run npm install
$ cd netlify-functions-example
$ npm install
npm start
This will start the client server on http://localhost:8080, and the netlify-lambda server on http://localhost:9000.
netlify-lambda isn’t required to deploy Lambda functions to Netlify, but it offers some handy features out of the box that make it quicker to get started, like the local dev server and nice defaults for transpiling and bundling functions in production.
The client server is configured to proxy /.netlify
requests to the Lambda server (see webpack.client.js). This is the same behavior the site has when it’s deployed to Netlify.