Add isTesting define for local testing of the api
This commit is contained in:
parent
fc0c98e4d2
commit
26aa6dca41
|
@ -13,14 +13,18 @@ type
|
|||
episode*: int ## the episode number in the season
|
||||
is_movie*: bool ## does this record represent a movie?
|
||||
|
||||
const
|
||||
API_ENDPOINT: string = "http://ponyapi.apps.xeserv.us"
|
||||
when defined(isTesting):
|
||||
const
|
||||
API_ENDPOINT: string = "http://127.0.0.1:5000"
|
||||
else:
|
||||
const
|
||||
API_ENDPOINT: string = "http://ponyapi.apps.xeserv.us"
|
||||
|
||||
proc getJson(endpoint: string): json.JsonNode =
|
||||
## get the HTTP body for the API base endpoint catted with the specific endpoint
|
||||
## requested.
|
||||
var
|
||||
data = httpclient.getContent(API_ENDPOINT & "/" & endpoint)
|
||||
data = httpclient.getContent(API_ENDPOINT & endpoint)
|
||||
|
||||
data.parseJson
|
||||
|
||||
|
|
Loading…
Reference in New Issue