Merge pull request #392 from CrowCpp/doc-crow-features

documented CROW_FEATURES
This commit is contained in:
Farook Al-Sammarraie 2022-04-08 14:27:10 +03:00 committed by GitHub
commit 4043595e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 8 deletions

View File

@ -6,10 +6,11 @@ Here's how you can install Crow on your favorite GNU/Linux distro.
- boost library & development headers (1.64 or later).
- **(optional)** ZLib for HTTP Compression.
- **(optional)** OpenSSL for HTTPS support.
- **(optional)** CMake and Python3 to build tests and/or examples.
!!!note
- **(optional)** CMake for building tests, examples, and/or installing Crow.
- **(optional)** Python3 to build tests and/or examples.
!!! note
Crow's CI uses `g++-9.3` and `clang-7.0` running on AMD64 (x86_64) and ARM64v8 architectures.
Crow's CI uses `g++-9.4` and `clang-10.0` running on AMD64 (x86_64) and ARM64v8 architectures.
<br><br>
@ -42,6 +43,10 @@ You can also download the `crow_all.h` file and simply include that into your pr
You can ignore `-DCROW_BUILD_EXAMPLES=OFF -DCROW_BUILD_TESTS=OFF` if you want to build the Examples and Unit Tests.
!!! note
While building you can set the `CROW_FEATURES` variable (as a `;` separated list). You can use an argument such as `-DCROW_FEATURES="ssl;compression"`.
!!! note
You can uninstall Crow at a later time using `make uninstall`.
@ -76,6 +81,10 @@ find_package(Crow)
target_link_libraries(your_project PUBLIC Crow::Crow)
```
From there CMake should handle compiling and linking your project.
!!! note
For optional features like HTTP Compression or HTTPS you can set the `CROW_FEATURES` variable using lines such as `set(CROW_FEATURES "ssl;compression")`, `set(CROW_FEATURES ssl compression)`, or `set(CROW_FEATURES ssl)`.
### Directly using a compiler
All you need to do is run the following command:
```

View File

@ -58,7 +58,7 @@ This will generate a `crow_all.h` file which you can use in the following steps
4. `make -j12`
!!! note
You can add options like `-DCROW_ENABLE_SSL`, `-DCROW_ENABLE_COMPRESSION`, or `-DCROW_AMALGAMATE` to `cmake ..` to build their tests/examples.
You can add options like `-DCROW_FEATURES="ssl;compression"` or `-DCROW_AMALGAMATE` to `cmake ..` to build optional tests/examples for HTTP Compression or HTTPS.
## Compiling using a compiler directly
All you need to do is run the following command:

View File

@ -3,7 +3,7 @@ Crow supports Zlib compression using Gzip or Deflate algorithms.
## HTTP Compression
HTTP compression is by default disabled in crow. Do the following to enable it: <br>
- Define `CROW_ENABLE_COMPRESSION` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_COMPRESSION` for example) or `CMakeLists.txt`.
- Define `CROW_ENABLE_COMPRESSION` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_COMPRESSION` for example) or `set(CROW_FEATURES compression)` in `CMakeLists.txt`.
- Call `#!cpp use_compression(crow::compression::algorithm)` on your Crow app.
- When compiling your application, make sure that ZLIB is included as a dependency. Either through `-lz` compiler argument or `find_package(ZLIB)` in CMake.

View File

@ -24,7 +24,7 @@ The key in the map is what's in the brackets (`sub_key1` for example), and the v
## pop_dict(name)
**Introduced in: `v0.3`**<br><br>
Works the same as `get_dict` but removing the values from the query string.
!!!warning
!!! warning
if your query string contains both a list and dictionary with the same key, it is best to use `pop_list` before either `get_dict` or `pop_dict`, since a map cannot contain more than one value per key, each item in the list will override the previous and only the last will remain with an empty key.

View File

@ -1,6 +1,6 @@
Crow supports HTTPS though SSL or TLS.<br><br>
!!!note
!!! note
When mentioning SSL in this documentation, it is often a reference to openSSL, which includes TLS.<br><br>
@ -8,7 +8,7 @@ Crow supports HTTPS though SSL or TLS.<br><br>
To enable SSL, first your application needs to define either a `.crt` and `.key` files, or a `.pem` file. Once you have your files, you can add them to your app like this:<br>
`#!cpp app.ssl_file("/path/to/cert.crt", "/path/to/keyfile.key")` or `#!cpp app.ssl_file("/path/to/pem_file.pem")`. Please note that this method can be part of the app method chain, which means it can be followed by `.run()` or any other method.<br><br>
You also need to define `CROW_ENABLE_SSL` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_SSL` for example) or `CMakeLists.txt`.
You also need to define `CROW_ENABLE_SSL` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_SSL` for example) or `set(CROW_FEATURES ssl)` in `CMakeLists.txt`.
You can also set your own SSL context (by using `boost::asio::ssl::context ctx`) and then applying it via the `#!cpp app.ssl(ctx)` method.<br><br>