Commit graph

12 commits

Author SHA1 Message Date
Augusto Dwenger 6ce7d15af9 Add test to the auth middleware 2020-10-30 14:41:15 +01:00
Augusto Dwenger b07ffc5f7e Impement auth middleware
The middleware checks for the presents of a 'Token' header and
if the provided token is valid. It adds a authorization layer with
some basic configuration options.
2020-10-30 12:18:26 +01:00
Augusto Dwenger 2ae33c6e1b Add default middlewares
Add request logging middleware
Add panic recover middleware
2020-10-30 11:31:57 +01:00
Augusto Dwenger 6ac85cc2a8 Change testing from assertion to require
The benefit of require is that on a fail it will stop the test
execution.
2020-10-27 12:07:52 +01:00
Augusto Dwenger 445055c332 Add error better handling for PostStats func 2020-10-26 22:29:57 +01:00
Augusto Dwenger d4bcc3d453 Change error message in GetStats
Add more tests.
2020-10-26 21:51:54 +01:00
Augusto Dwenger 1661266f9e Fix if an unknown error happens getting the host information
The function will now exit earlier and write an 500 status code
with the error message to the response.
2020-10-24 17:51:11 +02:00
Augusto Dwenger c550341eb9 Add error response if pagination query is negative 2020-10-24 12:16:02 +02:00
Augusto Dwenger b8f6a1a65b Add first test for GetHosts -> proof of concept
Implementing first http test.
2020-10-20 21:01:53 +02:00
Augusto Dwenger 7f817e166f Implement logrus for logging
Fix wrong error handling if host was not found getting the stats for it.
Add configuration flags to configure the logging.
2020-10-18 19:01:40 +02:00
Augusto Dwenger 3dfb18f67d Change returned status code to 201 2020-10-18 17:02:10 +02:00
Augusto Dwenger 44897b3b5a Implement the hosts controller
Simple interaction with the db like getting some data and inserting
new data points into it.
2020-10-18 15:38:57 +02:00