tn819 / serverless_experiment

AWS lambda serverless API using Dynamo DB and Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serverless file upload setup with Claudia + Node

  1. route for user location json file upload
  2. internal api for getting all locations
  3. internal api for getting location details

build steps

configure AWS and get necessary authorizations

install packages

npm install

creates endpoint in AWS API Gateway, Dynamo DB authorizations for user

npm run create

update endpoint

npm run update

use created URL with routes (AWS_IAM authorized profile needed for gets)

POST: /location

expects JSON with this body:

{
    name: "test",
    latitude: number,
    longitude: number
}

return location with distance to office

GET: /location/{id}

{
    "uploadDate": 1559655787236,
    "name": "test",
    "latitude": 52.5,
    "fileid": "2532f81d-1bb1-4cc7-a058-9496c7f25ca6",
    "longitude": 13.4,
    "distance": 647.246784882032
}

return all locations uploaded to dynamoDb

GET: /locations

About

AWS lambda serverless API using Dynamo DB and Node


Languages

Language:JavaScript 100.0%