mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge pull request #646 from robertgodfrey/doc-update
Minor updates to docs
This commit is contained in:
commit
3c94ea3874
@ -119,10 +119,10 @@ int main()
|
||||
}
|
||||
```
|
||||
|
||||
1. We are adding a `string` variable to the URL and a counterpart (`std::string name`) to our Route, this can be anything the user wants.
|
||||
1. We are adding a `string` variable to the URL and a counterpart (`std::string name`) to our route - this can be anything the user wants.
|
||||
2. We are using `load()` instead of `load_text()` since we have an actual variable now.
|
||||
3. We are creating a new [context](../../guides/templating/#context) containing the `person` variable from our template and the `name` we got from the URL.
|
||||
4. we are using `render(ctx)` to apply our context to the template.
|
||||
4. We are using `render(ctx)` to apply our context to the template.
|
||||
|
||||
Now (after compiling the code and running the executable a second time) calling `http://localhost:18080/Bob` should return a webpage containing "Hello Bob!". **We did it!**
|
||||
|
||||
|
@ -70,3 +70,5 @@ g++ main.cpp -lpthread
|
||||
You'll need to install GCC via `brew install gcc`. the Clang compiler should be part of XCode or XCode command line tools.
|
||||
|
||||
You can use arguments like `-DCROW_ENABLE_DEBUG`, `-DCROW_ENABLE_COMPRESSION -lz` for HTTP Compression, or `-DCROW_ENABLE_SSL -lssl` for HTTPS support, or even replace g++ with clang++.
|
||||
|
||||
If GCC throws errors and your program does not compile, you may be using C++03 instead of ≥C++11. Use the flag `-std=c++11`.
|
||||
|
@ -32,7 +32,7 @@ Once you're happy with how you defined all your routes, you're going to want to
|
||||
``` cpp
|
||||
app.port(18080).multithreaded().run();
|
||||
```
|
||||
Please note that the `port()` and `multithreaded()` methods aren't needed, Though not using `port()` will cause the default port (`80`) to be used.<br>
|
||||
Please note that the `port()` and `multithreaded()` methods aren't needed, though not using `port()` will cause the default port (`80`) to be used.<br>
|
||||
|
||||
## Putting it all together
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<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>
|
||||
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 much more modular.<br><br>
|
||||
|
||||
In order for a blueprint to work, it has to be registered with a Crow app before the app is run. This can be done using `#!cpp app.register_blueprint(blueprint);`.<br><br>
|
||||
|
||||
|
@ -7,7 +7,7 @@ Crow comes with a simple and easy to use logging system.<br><br>
|
||||
## Setting up logging level
|
||||
You can set up the level at which crow displays logs by using the app's `loglevel(crow::LogLevel)` method.<br><br>
|
||||
|
||||
The available log levels are as follows (please not that setting a level will also display all logs below this level):
|
||||
The available log levels are as follows (please note that setting a level will also display all logs below this level):
|
||||
|
||||
- Debug
|
||||
- Info
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
A static file is any file that resides in the server's storage.
|
||||
|
||||
Crow supports returning Static files as responses in 2 ways.
|
||||
Crow supports returning static files as responses either implicitly or explicitly.
|
||||
|
||||
## Implicit
|
||||
Crow implicitly returns any static files placed in a `static` directory and any subdirectories, as long as the user calls the endpoint `/static/path/to/file`.<br><br>
|
||||
|
@ -2,7 +2,7 @@ Websockets are a way of connecting a client and a server without the request res
|
||||
|
||||
## Routes
|
||||
To create a websocket in Crow, you need a websocket route.<br>
|
||||
A websocket route differs from a normal route quite a bit. It uses A slightly altered `CROW_WEBSOCKET_ROUTE(app, "/url")` macro, which is then followed by a series of methods (with handlers inside) for each event. These are (sorted by order of execution):
|
||||
A websocket route differs from a normal route quite a bit. It uses a slightly altered `CROW_WEBSOCKET_ROUTE(app, "/url")` macro, which is then followed by a series of methods (with handlers inside) for each event. These are (sorted by order of execution):
|
||||
|
||||
|
||||
- `#!cpp onaccept([&](const crow::request& req, void** userdata){handler code goes here})`
|
||||
|
@ -55,7 +55,7 @@ nav:
|
||||
- MacOS: getting_started/setup/macos.md
|
||||
- Windows: getting_started/setup/windows.md
|
||||
- Your First Application: getting_started/your_first_application.md
|
||||
- A simple Webpage: getting_started/a_simple_webpage.md
|
||||
- A Simple Webpage: getting_started/a_simple_webpage.md
|
||||
- Guides:
|
||||
- Different parts of Crow:
|
||||
- App: guides/app.md
|
||||
|
Loading…
Reference in New Issue
Block a user