Git Product home page Git Product logo

nim-presto's Introduction

Presto - An efficient library for REST API implementation

Github action License: Apache License: MIT Stability: experimental

Installation

You can use Nim's official package manager Nimble to install Presto:

$ nimble install https://github.com/status-im/nim-presto.git

Documentation

Contributing

When submitting pull requests, please add test cases for any new features or fixes and make sure nimble test is still able to execute the entire test suite successfully.

License

Licensed and distributed under either of

or

at your option. These files may not be copied, modified, or distributed except according to those terms.

nim-presto's People

Contributors

arnetheduck avatar cheatfate avatar emilivanichkovv avatar etan-status avatar narimiran avatar stefantalpalaru avatar tersec avatar yyoncho avatar zah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nim-presto's Issues

CORS

After using a Nimbus beacon node find out that the server does not send CORS header
image
This header should be present and configurable via params (like the user can add some address to the CORS list).

importing presto/client reveals that presto is missing the encodeBytes proc

/home/monyarm/.nimble/pkgs/presto-0.0.4/presto/client.nim(808, 21) Error: undeclared identifier: 'encodeBytes'
candidates (edit distance, scope distance); see '--spellSuggest': 
 (4, 10): 'getBodyBytes' [proc declared in /home/monyarm/.nimble/pkgs/chronos-#asyncproc/chronos/apps/http/httpclient.nim(1145, 6)]
 (4, 10): 'getBodyBytes' [proc declared in /home/monyarm/.nimble/pkgs/chronos-#asyncproc/chronos/apps/http/httpclient.nim(1169, 6)]

presto uses the proc, but doesn't define it outside of tests/helpers

Error: undeclared identifier: 'decodeString'

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)

A very basic documentation and/or a few simple examples

Would love to use this for my first API project, but having no documentation is not really encouraging for beginners.
I could find no projects that make use of this as well.
Please try to provide the bare minimum. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.