Update for 28-04-22 14:45

This commit is contained in:
Tyler Perkins 2022-04-28 14:45:01 -04:00
parent 411d8d9546
commit 6be2eaaa2c
2 changed files with 46 additions and 0 deletions

View File

@ -50,3 +50,38 @@ HTTP methods include
* `crow::HTTPMethod::POST` * `crow::HTTPMethod::POST`
=== Catchall route === === Catchall route ===
By default, crow will return a 404 page for not defined routes. However the
special `CROW_CATCHALL_ROUTE(app)` macro can be used the same as other routes,
however the catchall route will be used to catch all undefined routes
== JSON ==
Crow has built in JSON support. Json values are broken into a read and write
object, `rvalue` and `wvalue`. They can take
* bool
* Number
* double
* int
* unsigned int
* std::string
* std::vector (LIST)
* Object (`crow::json::wvalue` or `crow::json::rvalue`)
`rvalue` is used for taking a JSON string and parsing it into `crow::json`. You
can only READ from a `rvalue`. To write to one, convert to `wvalue`. This is
done via `crow::json::wvalue wval(rval);`, where `rval` is the `rvalue` you
want to convert.
You can return a `wvalue` in a route handler, and the type is automatically
casted and the header Content-Type header is automatically set to
`application/json`.
== Mustache ==
See [[Mustache]]
An HTML page template with mustache tags is loaded into a
`crow::mustache::template_t`. The file needs to be in a templates directory.
These templates are read at runtime, and therefore need to be available to the
binary.

11
tech/Mustache.wiki Normal file
View File

@ -0,0 +1,11 @@
= Mustache =
Mustache is a syntax without logic for placing values into other files, such as
HTML. The syntax looks like a mustache.
{{{
<p>{{ Myvalue }}</p>
}}}