We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm struggling to adapt your tests to a working basic example because I get this error:
presto-0.0.4/presto/route.nim:300:13 Error: undeclared identifier: 'decodeString'
Here's my example:
import presto proc main() {.async.} = let serverAddress = initTAddress("127.0.0.1:30180") let router = RestRouter() router.api(MethodGet, "/exchange/{exchange}/orderbook/{symbol}/bid") do ( exchange: string, symbol: string ) -> RestApiResponse: return RestApiResponse.error(Http505, "\"Some error\"", "application/json") var sres = RestServerRef.new(router, serverAddress) let server = sres.get() server.start() main()
I am new to Nim and was hoping to get a basic REST API created with async background tasks providing data (hence the use of Async)
The text was updated successfully, but these errors were encountered:
Same issue here.
Sorry, something went wrong.
My code in case it helps:
import std/[json,sequtils], presto/[route, server], chronos let serverAddress = initTAddress("127.0.0.1:9000") proc validate(pattern: string, value: string): int = if pattern.startsWith("{") and pattern.endsWith("}"): 0 else: 1 var router = RestRouter.init(validate) # GET /test router.api(MethodGet, "/test/{a}") do (a: string) -> RestApiResponse: echo "Enter in get" let jsonString = """{"key": 3.14}""" return RestApiResponse.response(jsonString, contentType="application/json") var sres = RestServerRef.new(router, serverAddress) let restServer = sres.get() restServer.start() proc main() {.async.} = while true: await sleepAsync(1000) when isMainModule: waitFor main()
No branches or pull requests
I'm struggling to adapt your tests to a working basic example because I get this error:
presto-0.0.4/presto/route.nim:300:13 Error: undeclared identifier: 'decodeString'
Here's my example:
I am new to Nim and was hoping to get a basic REST API created with async background tasks providing data (hence the use of Async)
The text was updated successfully, but these errors were encountered: