Skip to content

elvisciotti/quotesApiNodeServerless

Repository files navigation

Quotes Api - Node.JS + SQLite on AWS lambda

RESTful endpoint to get quotes

Tech stack

  • Node.js 12, Express.js
  • SQLIte 3
  • AWS lambda (Serverless)
  • Docker

See the detailed article I wrote on medium.com

Endpoints

curl -s "http://localhost:3001/tags" | python -m json.tool
[
    "age",
    "alone",
    "amazing",
    ...
]    

curl -s "/quotes?limit=2&tag=age" | python -m json.tool
[
    {
        "author": "Clive Owen",
        "quote": "If you explode onto the scene at a very young age, there are so many people pulling you in different directions. It takes time to recalibrate and see what's important.",
        "tag": "age"
    },
    {
        "author": "Cindy Crawford",
        "quote": "The face you have at age 25 is the face God gave you, but the face you have after 50 is the face you earned.",
        "tag": "age"
    }
]

Local run

docker-compose up --build

db/quotes.db will be created based on CSV files

test with

`curl http://localhost:3001/tags`

tests

npm test

Deploy (AWS)

sls deploy

Troubleshooting

  • internal server error: invoke from Amazon, and the error log will show the details

About

AWS lambda + SQLITE3 endpoint returning quotes from CSV files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published