What Is It?
RESTinio is a header-only library for creating REST applications in C++14. It helps to create HTTP server that can handle requests asynchronously.
RESTinio is based on the well-known tools like nodejs/http-parser and Asio.
We created RESTinio with the following goals in mind:
- the simplicity of use. A user should be able to write it’s own embedded HTTP-server in just a few lines of code (just like that);
- freedom from boring tasks. A user should not care about tasks that can be done by the server. Like checking timeouts and so on;
- high level of customization. A user should be able to select features he or
she wants to use. For example, a user can select should the
asio::strand
be used or not (strand is not needed if a sever is run in a single-threaded mode). A user can use an express-like router (see Express router) or can do URL parsing by yourself. A user can use one of the ready-to-use timer managers or can provide its own. And so on… - a good enough performance. RESTinio probably won’t be the fastest REST-framework written in C++. But RESTinio should show a right balance between execution seed, resources consumption and feature richness.
RESTinio features
- HTTP/1.1 support.
- Async request handling. Cannot get the response data immediately? That’s ok, store a request handle somewhere and/or pass it to another execution context and get back to it when the data is ready.
- HTTP pipelining. Works well with async request handling.
- Timeout control. RESTinio can take care of bad connections that are like: send “GET /” and then just wait.
- Response builders. Need chunked-encoded body - then RESTinio has a special response builder for you (obviously it is not the only builder).
- ExpressJS-like request routing.
- Supports TLS (HTTPS).
- Basic WebSocket support. Simply restinio::websocket::basic::upgrade() the request handle and start WebSocket session on a corresponding connection.
- Can run on external asio::io_context. RESTinio is separated from execution context.
- Some tune options. One can set acceptor and socket options. When running RESTinio on a pool of threads connections can be accepted in parallel.
The status of RESTinio
Currently RESTinio is in rather state state and we think that since v.0.4.0 it is ready for production use.
However we do not mark this version as stable v.1.0.0 because we want to have a freedom to make compatibility breaking changes in RESTinio code if some flaws will be found in RESTinio design.
License
RESTinio is distributed BSD-3-CLAUSE license. General support is provided via Issues section on Bitbucket. If you need commercial support then contact info at stiffstream dot com for more information.