Tweet-311-Denver / tweet_311_denver_service

Backend for Tweet311Denver Turing Project
MIT License
1 stars 0 forks source link

Add key validation #36

Closed ap2322 closed 4 years ago

ap2322 commented 4 years ago

What's going on

Using the @hapi/joi validation library, I've added checks for a serviceKey on POST requests.

Where to start

Look at the lib/routes.js file where on POST routes, an option:validate:query is added. This checks against the lib.schema. Even though the code looks very repetitive, it works and uses a pretty powerful library!

ENV vs DB

This solution uses a SERVICE_KEY environment variable rather than checking a users database for a service_key.

Tested validation of serviceKey on post requests. Coverage at 58%

Closes #32

Also Travis

Messed around a bit with Travis, but I think the issue always boiled down to adding new ENV variables.

But now i'm making Travis run our tests without coverage.