mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge pull request #392 from CrowCpp/doc-crow-features
documented CROW_FEATURES
This commit is contained in:
commit
4043595e44
@ -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).
|
- boost library & development headers (1.64 or later).
|
||||||
- **(optional)** ZLib for HTTP Compression.
|
- **(optional)** ZLib for HTTP Compression.
|
||||||
- **(optional)** OpenSSL for HTTPS support.
|
- **(optional)** OpenSSL for HTTPS support.
|
||||||
- **(optional)** CMake and Python3 to build tests and/or examples.
|
- **(optional)** CMake for building tests, examples, and/or installing Crow.
|
||||||
!!!note
|
- **(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>
|
<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.
|
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
|
!!! note
|
||||||
|
|
||||||
You can uninstall Crow at a later time using `make uninstall`.
|
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)
|
target_link_libraries(your_project PUBLIC Crow::Crow)
|
||||||
```
|
```
|
||||||
From there CMake should handle compiling and linking your project.
|
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
|
### Directly using a compiler
|
||||||
All you need to do is run the following command:
|
All you need to do is run the following command:
|
||||||
```
|
```
|
||||||
|
@ -58,7 +58,7 @@ This will generate a `crow_all.h` file which you can use in the following steps
|
|||||||
4. `make -j12`
|
4. `make -j12`
|
||||||
!!! note
|
!!! 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
|
## Compiling using a compiler directly
|
||||||
All you need to do is run the following command:
|
All you need to do is run the following command:
|
||||||
|
@ -3,7 +3,7 @@ Crow supports Zlib compression using Gzip or Deflate algorithms.
|
|||||||
|
|
||||||
## HTTP Compression
|
## HTTP Compression
|
||||||
HTTP compression is by default disabled in crow. Do the following to enable it: <br>
|
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.
|
- 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.
|
- When compiling your application, make sure that ZLIB is included as a dependency. Either through `-lz` compiler argument or `find_package(ZLIB)` in CMake.
|
||||||
|
|
||||||
|
@ -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)
|
## pop_dict(name)
|
||||||
**Introduced in: `v0.3`**<br><br>
|
**Introduced in: `v0.3`**<br><br>
|
||||||
Works the same as `get_dict` but removing the values from the query string.
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Crow supports HTTPS though SSL or TLS.<br><br>
|
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>
|
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>
|
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>
|
`#!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>
|
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>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user