Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
asim authored Feb 19, 2022
1 parent e118971 commit 13ceb70
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/netlify-functions/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Netlify Functions

This repo provides code you can copy and paste to get up and running quickly with a function that will make calls to Micro APIs.
Here's some code you can copy/paste to get up and running quickly with a function that make calls to M3O APIs.

## Overview

Managed JAMstack platforms like [Netlify](https://www.netlify.com/products/functions/) and [Vercel](https://vercel.com/docs/serverless-functions/introduction) provide "functions" to help you build out backend functionality quickly and without the overhead of managing infrastructure.

The Micro API key should be kept secret; you should avoid embedding the API key in your frontend code, otherwise it can be reused by others without your knowledge. Instead, the preferred method of using the Micro APIs is to make the calls from your backend and serve the results to your frontend; this way you will not expose your API keys to the world.
The M3O API key should be kept secret; you should avoid embedding the API key in your frontend code, otherwise it can be reused by others without your knowledge. Instead, the preferred method of using the Micro APIs is to make the calls from your backend and serve the results to your frontend; this way you will not expose your API keys to the world.

## Getting started

The code for the function that will call Micro lives in [netlify/functions/example.js](netlify/functions/example.js). Copy this to the directory that contains your functions.
The code for the function that will call Micro lives in [netlify/functions/example.js](https://github.com/m3o/m3o/blob/main/examples/netlify-functions/netlify/functions/example.js). Copy this to the directory that contains your functions.

The function takes the body of the request and uses that as the body of the call to Micro. The example is setup to call [helloworld/call](https://m3o.com/helloworld#Call) so tweak this as you need.

Expand All @@ -21,5 +21,6 @@ npm install --save @netlify/zip-it-and-ship-it
npm install --save @m3o/m3o-node
```

Make sure you save your Micro API token (https://m3o.com/settings/keys) and save it as an environment variable (`M3O_API_TOKEN`) on Netlify.
Generate your [M3O API token](https://m3o.com/account/keys) and save it as an environment variable (`M3O_API_TOKEN`) on Netlify.

Then go ahead and deploy!

0 comments on commit 13ceb70

Please sign in to comment.