-
-
Notifications
You must be signed in to change notification settings - Fork 474
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Setting the CROW_DISABLE_STATIC_DIR define, e.g. via
target_compile_definitions(Crow INTERFACE CROW_DISABLE_STATIC_DIR)
in the CMakeLists.txt, disables all blueprint paths.
Steps to reproduce the behavior:
- Set the define CROW_DISABLE_STATIC_DIR
- Compile the
example_blueprint.cpp
- Run it and try to access any blueprint route
To make the error more apparent
changing the line:
app.loglevel(crow::LogLevel::Debug).port(18080).run();
to
auto future = app.loglevel(crow::LogLevel::Debug).port(18080).run_async();
app.debug_print();
future.get();
clearly shows no routes at all.
(2024-11-11 22:54:53) [DEBUG ] Routing:
(2024-11-11 22:54:53) [INFO ] Crow/master server is running at http://0.0.0.0:18080 using 2 threads
(2024-11-11 22:54:53) [INFO ] Call `app.loglevel(crow::LogLevel::Warning)` to hide Info level logs.
(2024-11-11 22:54:53) [DEBUG ] 0000026706D1B590 {0} queue length: 1
Expected behavior
The non static blueprint routes should still be available.
Analysis
It looks like the code
#ifndef CROW_DISABLE_STATIC_DIR
add_blueprint();
add_static_dir();
#endif
in app.h is the only position where add_blueprint() and within it router_.validate_bp();
gets called.
One possible fix would be to move router_.validate_bp();
into the Crow::validate method.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity