Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.1.1 #781

Closed
wants to merge 11 commits into from
4 changes: 1 addition & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: Build and test
#on: push
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
branches: [ "v1.1" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/doxygen-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy Doxygen results to Github Pages
on:
push:
branches:
- master
- v1.1

permissions:
contents: write
Expand Down Expand Up @@ -33,10 +33,8 @@ jobs:
run: |
git config --global user.name Docs deploy
git config --global user.email docs@dummy.bot.com
- name: run mike
run: mike deploy master
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site # The folder the action should deploy.
target-folder: master # deploy to versioned directory
- name: run mike (Deploy 🚀)
run: |
git fetch origin gh-pages --depth=1
mike deploy 1.1 --push

14 changes: 9 additions & 5 deletions docs/getting_started/a_simple_webpage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hello World is a good start, but what if you want something a bit more fancy.. Something like an HTML document saying "Hello World". If that's what you want, follow along:

## Basic Webpage
Let's start our webpage with.. well.. a webpage. But before we create a webpage we need to place it somewhere Crow recognizes, for now this directory is going to be called `templates`, but we can [change it later](../../guides/templating/#page).
Let's start our webpage with.. well.. a webpage. But before we create a webpage we need to place it somewhere Crow recognizes, for now this directory is going to be called `templates`, but we can [change it later](../guides/templating.md#page).

Once our `templates` folder is created, we can create our HTML document inside it, let's call it `fancypage.html`.

Expand Down Expand Up @@ -80,13 +80,17 @@ Once the code is done compiling, if we call `http://localhost:18080/` we get our

!!! note

Compilation instructions are available for [Linux](../setup/linux#compiling-your-project), [MacOS](../setup/macos#compiling-using-a-compiler-directly), and [Windows](../setup/windows#getting-and-compiling-crow)
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)


## Template Webpage with a variable
But we can make things even more exciting, we can greet a user by their name instead!!

Let's start with our webpage, and modify it with a little bit of [mustache](../../guides/templating) syntax:
Let's start with our webpage, and modify it with a little bit of [mustache](../guides/templating.md) syntax:
``` html title="templates/fancypage.html" hl_lines="4"
<!DOCTYPE html>
<html>
Expand Down Expand Up @@ -121,9 +125,9 @@ 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.
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.
3. We are creating a new [context](../guides/templating.md#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.

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!**

For more details on templates and HTML pages in Crow please go [here](../../guides/templating/)
For more details on templates and HTML pages in Crow please go [here](../guides/templating.md)
9 changes: 6 additions & 3 deletions docs/getting_started/your_first_application.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main()
}
```
The App (or SimpleApp) class organizes all the different parts of Crow and provides the developer (you) a simple interface to interact with these parts.
For more information, please go [here](../../guides/app).
For more information, please go [here](../guides/app.md).

## 3. Adding routes
Once you have your app, the next step is to add routes (or endpoints). You can do so with the `CROW_ROUTE` macro.
Expand All @@ -25,7 +25,7 @@ CROW_ROUTE(app, "/")([](){
return "Hello world";
});
```
For more details on routes, please go [here](../../guides/routes).
For more details on routes, please go [here](../guides/routes.md).

## 4. Running the app
Once you're happy with how you defined all your routes, you're going to want to instruct Crow to run your app. This is done using the `run()` method.
Expand Down Expand Up @@ -56,6 +56,9 @@ int main()
}
```

You then need to compile your code on your [Linux](../setup/linux#compiling-your-project), [MacOS](../setup/macos#compiling-using-a-compiler-directly), or [Windows](../setup/windows#getting-and-compiling-crow) machine
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.
2 changes: 1 addition & 1 deletion docs/guides/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ app.bindaddr("192.168.1.2")

<br><br>

For more info on middlewares, check out [this page](../middleware).<br><br>
For more info on middlewares, check out [this page](middleware.md).<br><br>
For more info on what functions are available to a Crow app, go [here](../reference/classcrow_1_1_crow.html).
2 changes: 1 addition & 1 deletion docs/guides/included-middleware.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Crow contains some middlewares that are ready to be used in your application.
<br>
Make sure you understand how to enable and use [middleware](../middleware/).
Make sure you understand how to enable and use [middleware](middleware.md).

## Sessions
Include: `crow/middlewares/session.h` <br>
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The types of values that `rvalue and wvalue` can take are as follows:<br>
- `String`: from type `std::string`.
- `List`: from type `std::vector`.
- `Object`: from type `crow::json::wvalue or crow::json::rvalue`.<br>
This last type means that `rvalue or wvalue` can have keys.
≈bThis last type means that `rvalue or wvalue` can have keys.

## rvalue
JSON read value, used for taking a JSON string and parsing it into `crow::json`.<br><br>
Expand Down Expand Up @@ -41,7 +41,7 @@ Additionally, a `wvalue` can be initialized as an object using an initializer li

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.<br><br>

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).<br><br>
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).<br><br>

For more info on write values go [here](../reference/classcrow_1_1json_1_1wvalue.html).

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ There are 2 components of a mustache template implementation:
### Page
The HTML page (including the mustache tags). It is usually loaded into `crow::mustache::template_t`. It needs to be placed in the *templates directory* which should be directly inside the current working directory of the crow executable.<br><br>

The templates directory is usually called `templates`, but can be adjusted per Route (via `crow::mustache::set_base("new_templates_directory")`), per [Blueprint](../blueprints), or globally (via `crow::mustache::set_global_base("new_templates_directory"")`).<br><br>
The templates directory is usually called `templates`, but can be adjusted per Route (via `crow::mustache::set_base("new_templates_directory")`), per [Blueprint](blueprints.md), or globally (via `crow::mustache::set_global_base("new_templates_directory"")`).<br><br>

For more information on how to formulate a template, see [this mustache manual](http://mustache.github.io/mustache.5.html).

### Context
A JSON object containing the tags as keys and their values. `crow::mustache::context` is actually a [crow::json::wvalue](../json#wvalue).<br><br>
A JSON object containing the tags as keys and their values. `crow::mustache::context` is actually a [crow::json::wvalue](json.md#wvalue).<br><br>

!!! note

Expand Down
2 changes: 1 addition & 1 deletion include/crow/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

namespace crow
{
constexpr const char VERSION[] = "master";
constexpr const char VERSION[] = "1.1.1";
}
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ markdown_extensions:
- pymdownx.keys
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg


nav:
Expand Down
Loading