Implementation of /measure, /measurements APIs.

This commit is contained in:
Jonathan Bernard
2019-02-19 17:51:38 -06:00
parent 33eff538f8
commit 02e0d1cae1
9 changed files with 314 additions and 51 deletions

View File

@ -14,6 +14,9 @@ type
cfg*: PMApiConfig
db*: PMApiDb
BadRequestError* = object of CatchableError
AuthError* = object of CatchableError
proc `%`*(cfg: PMApiConfig): JsonNode =
result = %* {
"authSecret": cfg.authSecret,
@ -22,6 +25,10 @@ proc `%`*(cfg: PMApiConfig): JsonNode =
"port": cfg.port,
"pwdCost": cfg.pwdCost }
template raiseEx*(errorType: type, reason: string): void =
raise newException(errorType, reason)
proc raiseEx*(reason: string): void =
raise newException(Exception, reason)