diff --git a/src/js/lib/fetch.nim b/src/js/lib/fetch.nim new file mode 100644 index 0000000..e5020b2 --- /dev/null +++ b/src/js/lib/fetch.nim @@ -0,0 +1,20 @@ +import std/[ + asyncjs, + jsconsole, + jsfetch, + jsformdata, + jsheaders, + strformat, + sugar, + uri, +] +from std/httpcore import HttpMethod +from std/jsffi import JsObject + +const API_URL_DEFAULT = "http://localhost:1337/api/org" + +let defaultUri = parseUri(API_URL_DEFAULT) + +proc fetchOrgDocument*(path: string): Future[Response] {.async.} = + let uri = defaultUri / path + fetch(($uri).cstring)