From dfbce12d2bbe341e260ef3df8f0d6e659af0e22c Mon Sep 17 00:00:00 2001 From: fliiiix Date: Fri, 30 Aug 2024 09:23:03 +0200 Subject: [PATCH] Cleanup whitespace from docs (md) --- README.md | 24 +++++++++---------- docs/getting_started/a_simple_webpage.md | 8 +++---- docs/getting_started/setup/linux.md | 2 +- docs/getting_started/setup/macos.md | 6 ++--- docs/getting_started/setup/windows.md | 2 +- .../getting_started/your_first_application.md | 6 ++--- docs/guides/app.md | 2 +- docs/guides/auth.md | 2 +- docs/guides/base64.md | 1 - docs/guides/included-middleware.md | 2 +- docs/guides/json.md | 2 +- docs/guides/middleware.md | 8 +++---- docs/guides/proxies.md | 3 --- docs/guides/routes.md | 2 +- docs/guides/ssl.md | 2 +- 15 files changed, 34 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index ab6a50431..41d33a388 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Crow is a C++ framework for creating HTTP or Websocket web services. It uses rou Available [here](https://crowcpp.org). > **Warning** -> +> > If you are using Crow v0.3, then you have to put `#define CROW_MAIN` at the top of one and only one source file. ## Examples @@ -136,10 +136,10 @@ Crow has incorporated the following libraries into its source. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. + IN THE SOFTWARE. --------------------------------------------------------------------------- - + qs_parse (used for reading query string parameters) @@ -156,7 +156,7 @@ Crow has incorporated the following libraries into its source. all copies or substantial portions of the Software. --------------------------------------------------------------------------- - + TinySHA1 (used during the websocket handshake, not for security) @@ -167,23 +167,23 @@ Crow has incorporated the following libraries into its source. Copyright (c) 2012-22 SAURAV MOHAPATRA mohaps@gmail.com Permission to use, copy, modify, and distribute this software for any purpose - with or without fee is hereby granted, provided that the above copyright + with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - + --------------------------------------------------------------------------- - - + + Catch2 (used only in unit tests, not part of the actual framework) - + https://github.com/catchorg/Catch2 - + Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization diff --git a/docs/getting_started/a_simple_webpage.md b/docs/getting_started/a_simple_webpage.md index 5c017f7a5..233fbae41 100644 --- a/docs/getting_started/a_simple_webpage.md +++ b/docs/getting_started/a_simple_webpage.md @@ -80,10 +80,10 @@ Once the code is done compiling, if we call `http://localhost:18080/` we get our !!! note - Compilation instructions are available for - [Linux](setup/linux.md#compiling-your-project), - [MacOS](setup/macos.md#compiling-using-a-compiler-directly), - and + Compilation instructions are available for + [Linux](setup/linux.md#compiling-your-project), + [MacOS](setup/macos.md#compiling-using-a-compiler-directly), + and [Windows](setup/windows.md#getting-and-compiling-crow) diff --git a/docs/getting_started/setup/linux.md b/docs/getting_started/setup/linux.md index fde9e231a..5b5689652 100644 --- a/docs/getting_started/setup/linux.md +++ b/docs/getting_started/setup/linux.md @@ -86,7 +86,7 @@ From there CMake should handle compiling and linking your project. !!! note For optional features like HTTP Compression or HTTPS you can set - + the `CROW_ENABLE_SSL` variable to enable the support for https the `CROW_ENABLE_COMPRESSION` variable to enable the support for http compression diff --git a/docs/getting_started/setup/macos.md b/docs/getting_started/setup/macos.md index 9a7e2e0d1..b06536aa2 100644 --- a/docs/getting_started/setup/macos.md +++ b/docs/getting_started/setup/macos.md @@ -61,9 +61,9 @@ 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_COMPRESSION=ON` - or `-DCROW_ENABLE_SSL=ON` - or `-DCROW_AMALGAMATE` + You can add options like `-DCROW_ENABLE_COMPRESSION=ON` + or `-DCROW_ENABLE_SSL=ON` + or `-DCROW_AMALGAMATE` to `cmake ..` to build optional tests/examples for HTTP Compression or HTTPS. ## Compiling using a compiler directly diff --git a/docs/getting_started/setup/windows.md b/docs/getting_started/setup/windows.md index 92a11b851..45df5e5ab 100644 --- a/docs/getting_started/setup/windows.md +++ b/docs/getting_started/setup/windows.md @@ -18,5 +18,5 @@ The following guide will use `example_with_all.cpp` as the Crow application for 8. Add `crow_all.h` to `Header Files` and `example_with_all.cpp` to `Source Files`. 9. In solution explorer, right click the name of your project then click `Properties`. 10. Under `vcpkg`, set `Use Vcpkg Manifest` to `Yes` and `Additional Options` to `--feature-flags="versions"`. -11. Set `Debug/Release` and `x64/x86`. +11. Set `Debug/Release` and `x64/x86`. 12. Run. diff --git a/docs/getting_started/your_first_application.md b/docs/getting_started/your_first_application.md index 41c9a455c..ba4ed59fc 100644 --- a/docs/getting_started/your_first_application.md +++ b/docs/getting_started/your_first_application.md @@ -56,9 +56,9 @@ int main() } ``` -You then need to compile your code on your -[Linux](setup/linux.md#compiling-your-project), -[MacOS](setup/macos.md#compiling-using-a-compiler-directly), or +You then need to compile your code on your +[Linux](setup/linux.md#compiling-your-project), +[MacOS](setup/macos.md#compiling-using-a-compiler-directly), or [Windows](setup/windows.md#getting-and-compiling-crow) machine After building your `.cpp` file and running the resulting executable, you should be able to access your endpoint at [http://localhost:18080](http://localhost:18080). Opening this URL in your browser will show a white screen with "Hello world" typed on it. diff --git a/docs/guides/app.md b/docs/guides/app.md index bbfd0d49f..9c8db0b74 100644 --- a/docs/guides/app.md +++ b/docs/guides/app.md @@ -27,7 +27,7 @@ app.bindaddr("192.168.1.2") !!! note The `run()` method is blocking. To run a Crow app asynchronously `run_async()` should be used instead. - + !!! warning When using `run_async()`, make sure to use a variable to save the function's output (such as `#!cpp auto _a = app.run_async()`). Otherwise the app will run synchronously. diff --git a/docs/guides/auth.md b/docs/guides/auth.md index 8efeed329..0aaed34b7 100644 --- a/docs/guides/auth.md +++ b/docs/guides/auth.md @@ -16,7 +16,7 @@ Basic HTTP authentication requires the client to send the Username and Password We don't need to worry about creating the request, we only need to extract the credentials from the `Authorization` header and verify them. !!! note - There are multiple ways to verify the credentials. Most involve checking the username in a database, then checking a hash of the password against the stored password hash for that username. This tutorial will not go over them + There are multiple ways to verify the credentials. Most involve checking the username in a database, then checking a hash of the password against the stored password hash for that username. This tutorial will not go over them
diff --git a/docs/guides/base64.md b/docs/guides/base64.md index eddf94b08..05f1a9f39 100644 --- a/docs/guides/base64.md +++ b/docs/guides/base64.md @@ -1,4 +1,3 @@ - ## Encoding Using `#!cpp crow::utility::base64encode(mystring, mystring.size())` will return a Base64 encoded string. For URL safe Base64 `#!cpp crow::utility::base64encode_urlsafe(mystring, mystring.size())` can be used. The key used in the encoding process can be changed, it is a string containing all 64 characters to be used. diff --git a/docs/guides/included-middleware.md b/docs/guides/included-middleware.md index 1dd1bce2c..d7819d9e0 100644 --- a/docs/guides/included-middleware.md +++ b/docs/guides/included-middleware.md @@ -54,7 +54,7 @@ session.mutex().lock(); // manually lock session Expiration can happen either by the cookie expiring or the store deleting "old" data. -* By default, cookies expire after 30 days. This can be changed with the cookie option in the Session constructor. +* By default, cookies expire after 30 days. This can be changed with the cookie option in the Session constructor. * `crow::FileStore` automatically supports deleting files that are expired (older than 30 days). The expiration age can also be changed in the constructor. The session expiration can be postponed. This will make the Session issue a new cookie and make the store acknowledge the new expiration time. diff --git a/docs/guides/json.md b/docs/guides/json.md index a0be3a1be..336ecbbb6 100644 --- a/docs/guides/json.md +++ b/docs/guides/json.md @@ -40,7 +40,7 @@ A `wvalue` can be treated as an object or even a list (setting a value by using Additionally, a `wvalue` can be initialized as an object using an initializer list, an example object would be `wvalue x = {{"a", 1}, {"b", 2}}`. Or as a list using `wvalue x = json::wvalue::list({1, 2, 3})`, lists can include any type that `wvalue` supports.

An object type `wvalue` uses `std::unordered_map` by default, if you want to have your returned `wvalue` key value pairs be sorted (using `std::map`) you can add `#!cpp #define CROW_JSON_USE_MAP` to the top of your program.

- + A JSON `wvalue` can be returned directly inside a route handler, this will cause the `content-type` header to automatically be set to `Application/json` and the JSON value will be converted to string and placed in the response body. For more information go to [Routes](routes.md).

For more info on write values go [here](../reference/classcrow_1_1json_1_1wvalue.html). diff --git a/docs/guides/middleware.md b/docs/guides/middleware.md index f0b7dcbc4..58c1fc5ed 100644 --- a/docs/guides/middleware.md +++ b/docs/guides/middleware.md @@ -14,7 +14,7 @@ Any middleware requires the following 3 members: * A `before_handle` method, which is called before the handler. * A `after_handle` method, which is called after the handler. -!!! warning +!!! warning As soon as `response.end()` is called, no other handlers and middleware is run, except for after_handlers of already visited middleware. @@ -57,7 +57,7 @@ There are two possible signatures for before_handle and after_handle ``` cpp template - void before_handle(request& req, response& res, context& ctx, AllContext& all_ctx) + void before_handle(request& req, response& res, context& ctx, AllContext& all_ctx) { auto other_ctx = all_ctx.template get(); } @@ -68,7 +68,7 @@ There are two possible signatures for before_handle and after_handle By default, every middleware is called for each request. If you want to enable middleware for specific handlers or blueprints, you have to extend it from `crow::ILocalMiddleware` ```cpp -struct LocalMiddleware : crow::ILocalMiddleware +struct LocalMiddleware : crow::ILocalMiddleware { ``` @@ -90,6 +90,6 @@ bp.CROW_MIDDLEWARES(app, FistLocalMiddleware, SecondLocalMiddleware); ``` !!! warning - + Local and global middleware are called separately. First all global middleware is run, then all enabled local middleware for the current handler is run. In both cases middleware is called strongly in the order listed in the Crow application. diff --git a/docs/guides/proxies.md b/docs/guides/proxies.md index 19b305ff9..d66f306db 100644 --- a/docs/guides/proxies.md +++ b/docs/guides/proxies.md @@ -27,11 +27,8 @@ ProxyPassReverse / http://localhost:40080 If you want crow to run in a subdirectory (such as `domain.abc/crow`) you can use the `location` tag: ``` - ProxyPass http://localhost:40080 - ProxyPassReverse http://localhost:40080 - ``` diff --git a/docs/guides/routes.md b/docs/guides/routes.md index c1bfae6c7..18c26d011 100644 --- a/docs/guides/routes.md +++ b/docs/guides/routes.md @@ -98,7 +98,7 @@ Please note that in order to return a response defined as a parameter you'll nee Alternatively, you can define the response in the body and return it (`#!cpp ([](){return crow::response()})`).
For more information on `crow::response` go [here](../reference/structcrow_1_1response.html).

- + Crow defines the following status codes: ``` 100 Continue diff --git a/docs/guides/ssl.md b/docs/guides/ssl.md index ffbf7ecee..5066a13a3 100644 --- a/docs/guides/ssl.md +++ b/docs/guides/ssl.md @@ -5,7 +5,7 @@ Crow supports HTTPS though SSL or TLS.

When mentioning SSL in this documentation, it is often a reference to openSSL, which includes TLS.

-To enable SSL, first your application needs to define either a `.crt` and `.key` files, or a `.pem` file. +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:
`#!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.