Skip to content

Commit 0c2d233

Browse files
author
Roman Svozil
committed
feat: introduce functions for working with env and rework a bit examples
1 parent 5f62863 commit 0c2d233

20 files changed

+436
-304
lines changed

CMakeLists.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ cmake_minimum_required(VERSION 3.28)
33
set(CMAKE_CXX_STANDARD 23)
44
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55

6-
# Specify the C++ compiler (Clang++)
7-
# set(CMAKE_CXX_COMPILER "/opt/homebrew/opt/llvm/bin/clang++")
8-
96
# Specify the minimum compiler version that supports C++23
107
set(CMAKE_CXX_COMPILER_VERSION 17.0) # Update this based on your actual compiler version
118

@@ -29,7 +26,7 @@ if(Boost_FOUND)
2926
target_link_libraries(fhttplib ${Boost_LIBRARIES})
3027
endif()
3128

32-
add_subdirectory(examples)
29+
add_subdirectory(examples/basic_http_server)
3330

3431
# add_executable(cpp-playground src/cpp_playground.cc src/request_parser.cc src/data/json.cc)
3532
# target_compile_features(cpp-playground PUBLIC cxx_std_23)

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
# F(ast)HTTP
2+
`fhttp` is as library that provides fairly simple interface for building HTTP based servers, it provides "auto" json de/serialization, swagger generation and much more!
3+
4+
# Notice
5+
`fhttp` is currently mostly just a POC
6+
17
# todo
28
- tests
39
- at least somehow working library
4-
- at least performance of django:)
510
- swagger
6-
- middlewares
7-
- global app state for handlers
11+
- middlewares

examples/basic_http_server.cc

-279
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
add_executable(basic_http_server basic_http_server.cc)
1+
add_executable(basic_http_server src/main.cc)
22
target_link_libraries(basic_http_server PRIVATE fhttplib)
33
set_target_properties(basic_http_server PROPERTIES CXX_STANDARD 23)

examples/basic_http_server/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Example HTTP server
2+
In this example we're going through
3+
- creating models, that will be used for describing endpoint's requests and responses
4+
- creating views/handlers that consumes those models
5+
- creating shared configurations & config
6+
- generating OpenAPI endpoing with endpoint's specifications
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export app_port=8080
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include <string>
4+
5+
/// @brief Example of configuration for the server
6+
struct server_config {
7+
std::string mysql_connection_string;
8+
int mysql_timeout;
9+
10+
std::string redis_connection_string;
11+
int redis_timeout;
12+
13+
std::string static_files_path;
14+
std::string swagger_json;
15+
};

0 commit comments

Comments
 (0)