A Crow app defines an interface to allow the developer access to all the different parts of the framework, without having to manually deal with each one.
An app allows access to the HTTP server (for handling connections), router (for handling URLs and requests), Middlewares (for extending Crow), among many others.
Crow has 2 different app types:
Has no middlewares.
App<m1, m2, ...>¶
Using the app¶
To use a Crow app, simply define
crow::App<m1, m2 ...> if you're using middlewares.
The methods of an app can be chained. That means that you can configure and run your app in the same code line.
app.bindaddr(192.168.1.2) .port(443) .ssl_file("certfile.crt","keyfile.key") .multithreaded() .run();
run() method is blocking. To run a Crow app asynchronously
run_async() should be used instead.
run_async(), make sure to use a variable to save the function's output (such as
auto _a = app.run_async()). Otherwise the app will run synchronously.