mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
commit
31d2e07bc2
2
.gitignore
vendored
2
.gitignore
vendored
@ -29,3 +29,5 @@ unittest
|
||||
covtest
|
||||
*.gcda
|
||||
*.gcno
|
||||
|
||||
.directory
|
||||
|
12
Makefile
12
Makefile
@ -1,6 +1,9 @@
|
||||
binaries=covtest example
|
||||
|
||||
all: covtest example
|
||||
|
||||
example: example.cpp settings.h crow.h http_server.h http_connection.h parser.h http_response.h routing.h common.h utility.h json.h datetime.h logging.h
|
||||
g++ -Wall -g -O3 -std=c++11 -o example example.cpp http-parser/http_parser.c -pthread -lboost_system -lboost_thread -ltcmalloc_minimal -I http-parser/
|
||||
${CXX} -Wall -g -O3 -std=c++1y -o example example.cpp http-parser/http_parser.c -pthread -lboost_system -lboost_thread -ltcmalloc_minimal -I http-parser/
|
||||
|
||||
test: covtest
|
||||
|
||||
@ -11,12 +14,15 @@ runtest: example
|
||||
pkill example
|
||||
|
||||
unittest: unittest.cpp routing.h utility.h crow.h http_server.h http_connection.h parser.h http_response.h common.h json.h datetime.h logging.h
|
||||
g++ -Wall -g -std=c++11 -o unittest unittest.cpp http-parser/http_parser.c -pthread -lboost_system -lboost_thread -I http-parser/
|
||||
${CXX} -Wall -g -std=c++1y -o unittest unittest.cpp http-parser/http_parser.c -pthread -lboost_system -lboost_thread -I http-parser/
|
||||
./unittest
|
||||
|
||||
covtest: unittest.cpp routing.h utility.h crow.h http_server.h http_connection.h parser.h http_response.h common.h json.h datetime.h logging.h
|
||||
g++ -Wall -g -std=c++11 -o covtest --coverage unittest.cpp http-parser/http_parser.c -pthread -lboost_system -lboost_thread -I http-parser/
|
||||
${CXX} -Wall -g -std=c++1y -o covtest --coverage unittest.cpp http-parser/http_parser.c -pthread -lboost_system -lboost_thread -I http-parser/
|
||||
./covtest
|
||||
gcov -r unittest.cpp
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f $(binaries) *.o
|
||||
|
13
README.md
13
README.md
@ -1,12 +1,10 @@
|
||||
Crow
|
||||
====
|
||||
# Crow
|
||||
|
||||
Crow is C++ microframework for web. (inspired by Python Flask)
|
||||
|
||||
(still in development, not completed yet)
|
||||
|
||||
Example
|
||||
=======
|
||||
## Example
|
||||
|
||||
```c++
|
||||
|
||||
@ -69,5 +67,10 @@ int main()
|
||||
.multithreaded()
|
||||
.run();
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## How to Build
|
||||
|
||||
### Ubuntu
|
||||
sudo apt-get install build-essential libtcmalloc-minimal4 && sudo ln -s /usr/lib/libtcmalloc_minimal.so.4 /usr/lib/libtcmalloc_minimal.so
|
||||
make -j$(($(grep -c '^processor' /proc/cpuinfo)+1))
|
||||
|
3
crow.h
3
crow.h
@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <future>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <thread>
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace crow
|
||||
HTTPParser<Connection> parser_;
|
||||
response res;
|
||||
|
||||
int life_;
|
||||
int life_ {};
|
||||
bool close_connection_ = false;
|
||||
|
||||
const std::string& server_name_;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <atomic>
|
||||
|
||||
#include "http_connection.h"
|
||||
@ -12,6 +12,7 @@ namespace crow
|
||||
{
|
||||
using namespace boost;
|
||||
using tcp = asio::ip::tcp;
|
||||
|
||||
template <typename Handler>
|
||||
class Server
|
||||
{
|
||||
|
2
json.h
2
json.h
@ -939,7 +939,7 @@ namespace crow
|
||||
type t() { return t_; }
|
||||
private:
|
||||
type t_{type::Null};
|
||||
double d;
|
||||
double d {};
|
||||
std::string s;
|
||||
std::unique_ptr<std::vector<wvalue>> l;
|
||||
std::unique_ptr<std::unordered_map<std::string, wvalue>> o;
|
||||
|
@ -2,12 +2,14 @@
|
||||
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace crow
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "http_response.h"
|
||||
#include "http_request.h"
|
||||
#include "utility.h"
|
||||
#include "logging.h"
|
||||
|
||||
namespace crow
|
||||
{
|
||||
@ -182,7 +183,7 @@ namespace crow
|
||||
void operator()(std::string name, Func&& f)
|
||||
{
|
||||
name_ = std::move(name);
|
||||
(*this).operator()<Func>(std::forward(f));
|
||||
(*this).template operator()<Func>(std::forward(f));
|
||||
}
|
||||
|
||||
response handle(const request& req, const routing_params& params)
|
||||
|
Loading…
Reference in New Issue
Block a user