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

Changed documentation. a lot. #71

Merged
merged 4 commits into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .gitmodules
Empty file.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ addons:
packages:
- libboost-all-dev
- doxygen
- doxygen-doc
- doxygen-latex
- doxygen-gui
- mkdocs
- graphviz

before_install:
- if [ "$TRAVIS_COMPILER" == "gcc" -a "$TRAVIS_CPU_ARCH" == "amd64" ]; then export PUSH_COVERAGE=ON; fi
- if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" -a "$PUSH_COVERAGE" == "ON" ]; then export TRAVIS_BUILD_DOCS=ON; fi
- if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" -a "$PUSH_COVERAGE" == "ON" ]; then export TRAVIS_BUILD_DOCS=ON; pip install mkdocs-material; fi

install:
- if [ "$PUSH_COVERAGE" == "ON" ]; then pip install --user cpp-coveralls; fi
Expand Down
10 changes: 2 additions & 8 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,6 @@ TAB_SIZE = 2

ALIASES =

# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.

TCL_SUBST =

# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
Expand Down Expand Up @@ -990,7 +984,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.

USE_MDFILE_AS_MAINPAGE = readme.md
USE_MDFILE_AS_MAINPAGE = README.md

#---------------------------------------------------------------------------
# Configuration options related to source browsing
Expand Down Expand Up @@ -1119,7 +1113,7 @@ GENERATE_HTML = YES
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_OUTPUT = html
HTML_OUTPUT = site/reference

# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
# generated HTML page (for example: .htm, .php, .asp).
Expand Down
113 changes: 43 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
![Crow logo](https://pixeldrain.com/api/file/DMc7xYye)
<p align="center"><img src="https://pixeldrain.com/api/file/DMc7xYye" width=600></p>

<h4 align="center">A Fast and Easy to use microframework for the web.</h4>
<p align="center">
<a href="https://travis-ci.com/mrozigor/crow"><img src="https://travis-ci.com/mrozigor/crow.svg?branch=master" alt="Build Status"></a>
<a href="https://coveralls.io/github/mrozigor/crow?branch=master"><img src="https://coveralls.io/repos/github/mrozigor/crow/badge.svg?branch=master" alt="Coverage Status"></a>
<a href="https://mrozigor.github.io/crow"><img src="https://img.shields.io/badge/-Documentation-informational" alt="Documentation"></a>
<a href="https://gitter.im/crowfork/community?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge"><img src="https://badges.gitter.im/crowfork/community.svg" alt="Gitter"></a>
</p>


## Description

Crow is a C++ microframework for running web services. It uses routing similar to Python's Flask which makes it easy to use. It is also extremely fast, beating multiple existing C++ frameworks as well as non C++ frameworks.

### Features
- Easy Routing (similar to flask).
- Type-safe Handlers.
- Blazingly fast (see [this benchmark](https://github.com/ipkn/crow-benchmark) and [this benchmark](https://github.com/guteksan/REST-CPP-benchmark)).
- Built in JSON support.
- [Mustache](http://mustache.github.io/) based templating library (`crow::mustache`).
- Header only library (single header file available).
- Middleware support for extensions.
- HTTP/1.1 and Websocket support.
- Multi-part request and response support.
- Uses modern C++ (11/14)

### Still in development
- [HTTP/2 support](https://github.com/mrozigor/crow/issues/8)

Crow is a C++ microframework for web. (inspired by Python Flask)
## Documentation
Available [here](https://mrozigor.github.io/crow).

[![Build Status](https://travis-ci.com/mrozigor/crow.svg?branch=master)](https://travis-ci.com/mrozigor/crow)
[![Coverage Status](https://coveralls.io/repos/github/mrozigor/crow/badge.svg?branch=master)](https://coveralls.io/github/mrozigor/crow?branch=master)
[![Documentation](https://img.shields.io/badge/-Documentation-informational)](https://mrozigor.github.io/crow)
[![Gitter](https://badges.gitter.im/crowfork/community.svg)](https://gitter.im/crowfork/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
## Examples

#### Hello World
```c++
#include "crow.h"

Expand All @@ -22,32 +49,8 @@ int main()
}
```

## Features

- Easy routing
- Similiar to Flask
- Type-safe Handlers (see Example)
- Very Fast
- ![Benchmark Result in one chart](https://docs.google.com/spreadsheets/d/1KidO9XpuwCRZ2p_JRDJj2aep61H8Sh_KDOhApizv4LE/pubchart?oid=2041467789&format=image)
- More data on [crow-benchmark](https://github.com/ipkn/crow-benchmark)
- Fast built-in JSON parser (crow::json)
- You can also use [json11](https://github.com/dropbox/json11) or [rapidjson](https://github.com/miloyip/rapidjson) for better speed or readability
- [Mustache](http://mustache.github.io/) based templating library (crow::mustache)
- Header only
- All-in-one header file available
- Middleware support
- Websocket support

## Still in development
- [Informational webpage](https://mrozigor.github.io/crow) (what is crow, guides, examples, etc..)
- [HTTP/2 support](https://github.com/mrozigor/crow/issues/8)
- ~~Built-in ORM~~
- Check [sqlpp11](https://github.com/rbock/sqlpp11) if you want one.

## Examples

#### JSON Response
```c++
```cpp
CROW_ROUTE(app, "/json")
([]{
crow::json::wvalue x;
Expand All @@ -57,7 +60,7 @@ CROW_ROUTE(app, "/json")
```

#### Arguments
```c++
```cpp
CROW_ROUTE(app,"/hello/<int>")
([](int count){
if (count > 100)
Expand All @@ -68,7 +71,7 @@ CROW_ROUTE(app,"/hello/<int>")
});
```
Handler arguments type check at compile time
```c++
```cpp
// Compile error with message "Handler type is mismatched with URL paramters"
CROW_ROUTE(app,"/another/<int>")
([](int a, int b){
Expand All @@ -77,7 +80,7 @@ CROW_ROUTE(app,"/another/<int>")
```

#### Handling JSON Requests
```c++
```cpp
CROW_ROUTE(app, "/add_json")
.methods("POST"_method)
([](const crow::request& req){
Expand All @@ -91,47 +94,17 @@ CROW_ROUTE(app, "/add_json")
});
```

## How to Build

If you just want to use crow, generate `crow_all.h` (use script `scripts/merge_all.py`) and include it.

### Requirements

- C++ compiler with good C++14 support.
- Tested on g++-9.3 and clang-7.0, AMD64 (x86_64) and Arm64 v8
- boost 1.7 library.
- (optional) CMake to build tests and/or examples.
- (optional) Linking with tcmalloc/jemalloc is recommended for speed.

### Building (Tests, Examples)

Out-of-source build with CMake is recommended.

```
mkdir build
cd build
cmake ..
make
```

You can run tests with following commands:
```
ctest
```

### Installing missing dependencies
More examples can be found [here](https://github.com/mrozigor/crow/tree/master/examples).

#### Ubuntu
sudo apt-get install build-essential libtcmalloc-minimal4 && sudo ln -s /usr/lib/libtcmalloc_minimal.so.4 /usr/lib/libtcmalloc_minimal.so
## Setting Up / Building
Available [here](https://mrozigor.github.io/crow/getting_started/setup).

#### OSX
brew install boost google-perftools

### Attributions

Crow uses the following libraries.

http-parser
http-parser (used for converting http strings to crow::request objects)

https://github.com/nodejs/http-parser

Expand Down Expand Up @@ -160,7 +133,7 @@ Crow uses the following libraries.
IN THE SOFTWARE.


qs_parse
qs_parse (used for reading query string parameters)

https://github.com/bartgrantham/qs_parse

Expand All @@ -175,7 +148,7 @@ Crow uses the following libraries.
all copies or substantial portions of the Software.


TinySHA1
TinySHA1 (used during the websocket handshake, not for security)

https://github.com/mohaps/TinySHA1

Expand Down
Loading