handling preflight requests in a better way

also added some tests
bundling injection to web handler package and privatizing app functions
app tests are now working
removed unnecessary helper
cleaned up storage and mongo specific code
fixed issue with scope.ndays type confusion

digit comparison is not consistent over string and number
hardcoding userid header
added factorlog as logger