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.
What's going on
Using the
@hapi/joi
validation library, I've added checks for aserviceKey
onPOST
requests.Where to start
Look at the
lib/routes.js
file where onPOST
routes, anoption:validate:query
is added. This checks against thelib.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.