btcrs / gardeners-log

A serverless API for my garden

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gardeners-log

banner

Serverless gateway for a CRUD API that maintains my garden's data

This API was built to serve and recieve data entries from various IOT sensors. The data's schema is very simple and expected to be arrive on a semi-regular basis. Data is meant to be accessible by everyone, but modified only by authenticated users. Data is sent to the API autonomously, so creation of entries requires only an API key. However, detetion and modification of data, both user actions, requires an Oauth token to be sent with the request.

This API is currently hosted with AWS Lambda, so the authorized functions found in the authentication module are used to grant or deny access.

Table of Contents

Install

The project utilizes the Serverless framework. Assuming you have Serverless installed and your AWS account confiured, installation requires only a single command.

serverless deploy

Make sure to update the api authorizers with your authentication function's URL.

Usage

Create

curl -X POST https://XXXX.execute-api.region.amazonaws.com/dev/datum --data '{ }'

Read all

curl https://XXXX.execute-api.region.amazonaws.com/dev/datum

Read one

curl https://XXXX.execute-api.region.amazonaws.com/dev/datum/<id>

Update

curl -X PUT https://XXXX.execute-api.region.amazonaws.com/dev/datum/<id> --data '{}'

DELETE

curl -X DELETE https://XXXX.execute-api.region.amazonaws.com/dev/datum/<id>

Contribute

PRs accepted.

License

MIT © Ben Carothers

About

A serverless API for my garden


Languages

Language:JavaScript 100.0%