Crow/docs/guides/app.md
The-EDev 2665086a49
multiple docs changes:
Added meta tags for homepage
Added meta description generator
Removed usages of <h1> (mkdocs-material doesn't reconize more than 1)
added space after # (markdown proper syntax)
removed pip3 command from pull request CI
2021-11-06 11:54:29 +03:00

1.1 KiB

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), amoung many others.

Crow has 2 different app types:

SimpleApp

Has no middlewares.

App<m1, m2, ...>

Has middlewares.

Using the app

To use a Crow app, simply define #!cpp crow::SimpleApp or #!cpp 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();

Or if you like your code neat

app.bindaddr(192.168.1.2)
.port(443)
.ssl_file("certfile.crt","keyfile.key")
.multithreaded()
.run();



For more info on middlewares, check out this page.

For more info on what functions are available to a Crow app, go here.