Add fetch
This commit is contained in:
20
src/js/lib/fetch.nim
Normal file
20
src/js/lib/fetch.nim
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user