diff --git a/.gitignore b/.gitignore index e42f508..7903b9f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,7 @@ node_modules .node_repl_history # Editor -.vscode* \ No newline at end of file +.vscode* + +# Environment files +.env/*.* \ No newline at end of file diff --git a/README.md b/README.md index aa8ec03..99bc384 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,31 @@ client.API(request, function (response) { # Usage + +Following is an example using SendGrid. You can get your free account [here](https://sendgrid.com/free?source=nodejs-http-client). + +First, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys). + +```bash +echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env +echo "sendgrid.env" >> .gitignore +source ./sendgrid.env +``` + +You can copy the .env_example file located in the "examples" folder to ```.env``` in your project's root. + +```cp examples/.env_sample .env``` + +Then add your API Key into the file + +Here is the [full working code](https://github.com/sendgrid/nodejs-http-client/blob/master/examples/example.js). + +To run the example: + +```bash +node examples/example +``` +======= [Library Usage Documentation](https://github.com/sendgrid/nodejs-http-client/blob/master/USAGE.md) diff --git a/examples/.env_sample b/examples/.env_sample new file mode 100644 index 0000000..30857f4 --- /dev/null +++ b/examples/.env_sample @@ -0,0 +1 @@ +export SENDGRID_API_KEY='' \ No newline at end of file