Crow/examples/example_catchall.cpp
The-EDev f779a0f8a4 changed catchall to fit with the rest of crow
the macro is similar to CROW_ROUTE, added example to cmake, added unit test, and documentation
2021-04-12 08:25:09 +03:00

21 lines
422 B
C++

#define CROW_MAIN
#include <crow.h>
int main()
{
crow::SimpleApp app;
CROW_ROUTE(app, "/")([](){return "Hello";});
//Setting a custom route for any URL that isn't defined, instead of a simple 404.
CROW_CATCHALL_ROUTE(app)
([](crow::response& res) {
res.body = "The URL does not seem to be correct.";
res.end();
});
app.port(18080).run();
}