mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
improved "introduced in" statements
This commit is contained in:
parent
9a736fafd8
commit
21cdd5cac2
@ -3,6 +3,7 @@
|
||||
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.
|
||||
|
||||
## Decoding
|
||||
**Introduced in: `v1.0`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v1.0](https://github.com/CrowCpp/Crow/releases/v1.0)</span>
|
||||
|
||||
|
||||
Using `#!cpp crow::utility::base64decode(mystring, mystring.size())` with `mystring` being a Base64 encoded string will return a plain-text string. The function works with both normal and URL safe Base64. However it cannot decode a Base64 string encoded with a custom key.
|
||||
|
@ -1,5 +1,6 @@
|
||||
**Introduced in: `v1.0`**<br><br>
|
||||
|
||||
<span class="tag">[:octicons-feed-tag-16: v1.0](https://github.com/CrowCpp/Crow/releases/v1.0)</span>
|
||||
|
||||
|
||||
Crow supports flask style blueprints.<br>
|
||||
A blueprint is a limited app. It cannot handle networking. But it can handle routes.<br>
|
||||
Blueprints allow developers to compartmentalize their Crow applications, making them a lot more modular.<br><br>
|
||||
|
@ -1,4 +1,6 @@
|
||||
**Introduced in: `v0.3`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.3](https://github.com/CrowCpp/Crow/releases/v0.3)</span>
|
||||
|
||||
|
||||
Crow supports Zlib compression using Gzip or Deflate algorithms.
|
||||
|
||||
## HTTP Compression
|
||||
|
@ -31,7 +31,8 @@ Writing a log is as simple as `#!cpp CROW_LOG_<LOG LEVEL> << "Hello";` (replace&
|
||||
Log times are reported in GMT timezone by default. This is because HTTP requires all reported times for requests and responses to be in GMT. This can be changed by using the macro `CROW_USE_LOCALTIMEZONE` which will set **only the log timezone** to the server's local timezone.
|
||||
|
||||
## Creating A custom logger
|
||||
**Introduced in: `v1.0`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v1.0](https://github.com/CrowCpp/Crow/releases/v1.0)</span>
|
||||
|
||||
|
||||
Assuming you have an existing logger or Crow's default format just doesn't work for you. Crow allows you to use a custom logger for any log made using the `CROW_LOG_<LOG LEVEL>` macro.<br>
|
||||
All you need is a class extending `#!cpp crow::ILogHandler` containing the method `#!cpp void log(std::string, crow::LogLevel)`.<br>
|
||||
|
@ -1,4 +1,5 @@
|
||||
**Introduced in: `v0.2`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.2](https://github.com/CrowCpp/Crow/releases/0.2)</span>
|
||||
|
||||
|
||||
Multipart is a way of forming HTTP requests or responses to contain multiple distinct parts.<br>
|
||||
|
||||
@ -21,7 +22,8 @@ A message can be created either by defining the headers, boundary, and individua
|
||||
|
||||
Once a multipart message has been made, the individual parts can be accessed throughout `msg.parts`, `parts` is an `std::vector`.<br><br>
|
||||
|
||||
**Introduced in: `v1.0`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v1.0](https://github.com/CrowCpp/Crow/releases/v1.0)</span>
|
||||
|
||||
|
||||
Part headers are organized in a similar way to request and response headers, and can be retrieved via `crow::multipart::get_header_object("header-key")`. This function returns a `crow::multipart::header` object.<br><br>
|
||||
|
||||
|
@ -5,7 +5,9 @@ Crow supports query strings through `crow::request::url_params`. The object is o
|
||||
## get(name)
|
||||
Returns the value (as char*) based on the given key (or name). Returns `nullptr` if the key is not found.
|
||||
## pop(name)
|
||||
**Introduced in: `v0.3`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.3](https://github.com/CrowCpp/Crow/releases/v0.3)</span>
|
||||
|
||||
|
||||
Works the same as `get`, but removes the returned value.
|
||||
!!! note
|
||||
|
||||
@ -16,13 +18,17 @@ A URL can be `http://example.com?key[]=value1&key[]=value2&key[]=value3`. Using
|
||||
|
||||
`#!cpp get_list("key", false)` can be used to parse `http://example.com?key=value1&key=value2&key=value3`
|
||||
## pop_list(name)
|
||||
**Introduced in: `v0.3`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.3](https://github.com/CrowCpp/Crow/releases/v0.3)</span>
|
||||
|
||||
|
||||
Works the same as `get_list` but removes all instances of values having the given key (`use_brackets` is also available here).
|
||||
## get_dict(name)
|
||||
Returns an `std::unordered_map<std::string, std::string>` from a query string such as `?key[sub_key1]=value1&key[sub_key2]=value2&key[sub_key3]=value3`.<br>
|
||||
The key in the map is what's in the brackets (`sub_key1` for example), and the value being what's after the `=` sign (`value1`). The name passed to the function is not part of the returned value.
|
||||
## pop_dict(name)
|
||||
**Introduced in: `v0.3`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.3](https://github.com/CrowCpp/Crow/releases/v0.3)</span>
|
||||
|
||||
|
||||
Works the same as `get_dict` but removing the values from the query string.
|
||||
!!! warning
|
||||
|
||||
|
@ -52,7 +52,9 @@ The main return type is `std::string`, although you could also return a `crow::j
|
||||
For more information on the specific constructors for a `crow::response` go [here](../../reference/structcrow_1_1response.html).
|
||||
|
||||
## Returning custom classes
|
||||
**Introduced in: `v0.3`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.3](https://github.com/CrowCpp/Crow/releases/v0.3)</span>
|
||||
|
||||
|
||||
If you have your own class you want to return (without converting it to string and returning that), you can use the `crow::returnable` class.<br>
|
||||
to use the returnable class, you only need your class to publicly extend `crow::returnable`, add a `dump()` method that returns your class as an `std::string`, and add a constructor that has a `Content-Type` header as a string argument.<br><br>
|
||||
|
||||
@ -75,12 +77,15 @@ class a : public crow::returnable
|
||||
<br><br>
|
||||
|
||||
## Response codes
|
||||
**Introduced in: `v1.0`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v1.0](https://github.com/CrowCpp/Crow/releases/v1.0)</span>
|
||||
|
||||
|
||||
Instead of assigning a response code, you can use the `crow::status` enum, for example you can replace `crow::response(200)` with `crow::response(crow::status::OK)`
|
||||
|
||||
## Catchall routes
|
||||
**Introduced in: `v0.3`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.3](https://github.com/CrowCpp/Crow/releases/v0.3)</span>
|
||||
|
||||
|
||||
By default, any request that Crow can't find a route for will return a simple 404 response. You can change that to return a default route using the `CROW_CATCHALL_ROUTE(app)` macro. Defining it is identical to a normal route, even when it comes to the `const crow::request&` and `crow::response&` parameters being optional.
|
||||
!!! note
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
**Introduced in: `v0.2`**<br><br>
|
||||
<span class="tag">[:octicons-feed-tag-16: v0.2](https://github.com/CrowCpp/Crow/releases/0.2)</span>
|
||||
|
||||
|
||||
A static file is any file that resides in the server's storage.
|
||||
|
||||
Crow supports returning Static files as responses in 2 ways.
|
||||
|
@ -7,6 +7,37 @@
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.tag
|
||||
{
|
||||
background-color: var(--md-primary-fg-color);
|
||||
color: var(--md-default-bg-color);
|
||||
border-radius: 50px;
|
||||
padding-left: 0.15em;
|
||||
padding-right: 0.35em;
|
||||
padding-top: 0.45em;
|
||||
padding-bottom: 0.35em;
|
||||
}
|
||||
|
||||
.tag a
|
||||
{
|
||||
color: var(--md-default-bg-color);
|
||||
}
|
||||
|
||||
.tag a:hover
|
||||
{
|
||||
color: var(--md-default-bg-color);
|
||||
}
|
||||
|
||||
.md-typeset :is(.emojione, .twemoji, .gemoji)
|
||||
{
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
.md-typeset :is(.emojione, .twemoji, .gemoji) svg
|
||||
{
|
||||
width: 1.25em;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="crow-dark"] img[src$="#only-dark"]
|
||||
{
|
||||
display: block;
|
||||
|
@ -40,6 +40,11 @@ markdown_extensions:
|
||||
- pymdownx.superfences
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.keys
|
||||
- attr_list
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
|
Loading…
Reference in New Issue
Block a user