presto

REST API implementation

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.1.3
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-11-17 13:48

Authors

  • Status Research & Development GmbH

Installation

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

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
presto ✓ ✓ ✓ - - - - - - -

Source

Repository https://github.com/status-im/nim-presto
Homepage https://github.com/status-im/nim-presto
Registry Source nimble_official

README

Presto - An efficient library for REST API implementation

Github action License: Apache License: MIT Stability: experimental

Presto is an asynchronous REST framework for Nim, built on top of the Chronos async I/O library. It provides:

  • a request router whose handlers receive path, query, and body parameters already unmarshalled into Nim types;
  • an HTTP and HTTPS server to run the router, or the option to embed it into an existing chronos server as middleware;
  • a strongly typed HTTP client generated at compile time from your own proc signatures;
  • built-in support for CORS and Prometheus-style metrics.

Installation

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

$ nimble install presto

To depend on Presto from your own package, add it to your .nimble file:

requires "presto"

Documentation

Full documentation is available as a book at status-im.github.io/nim-presto, with generated API reference under /api.

A minimal server looks like this:

import pkg/presto

proc decodeString*(t: typedesc[string], value: string): RestResult[string] =
  ok(value)

proc validate(pattern: string, value: string): int = 0

var router = RestRouter.init(validate)

router.api(MethodGet, "/") do () -> RestApiResponse:
  RestApiResponse.response("Hello World", Http200, "text/plain")

let server = RestServerRef.new(router, initTAddress("127.0.0.1:9000")).get()
server.start()
runForever()

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.

To build the documentation locally you need mdBook with the toc, open-on-gh, admonish, and shiftinclude preprocessors:

$ nimble docs      # generates both the API docs and the book into ./docs

License

Licensed and distributed under either of

  • MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT

or

  • Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0)

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