Crow/examples/example_catchall.cpp

21 lines
422 B
C++
Raw Normal View History

2021-04-05 08:21:14 +00:00
#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();
});
2021-04-05 08:21:14 +00:00
app.port(18080).run();
2021-04-05 08:21:14 +00:00
}