I have been following this example in the "Getting Started" page on Crow's website but the page is blank after compiling on Xcode.
**/main.cpp**
#include "crow.h"
//#include "crow_all.h"
int main()
{
crow::SimpleApp app;
//define your endpoint at the root directory
CROW_ROUTE(app, "/")([](){
auto page = crow::mustache::load_text("fancypage.html");
return page;
});
app.port(18080).multithreaded().run();
}
I followed the instructions provided regarding adding "fancypage.html" in the Crow project, however, I still receive the error "Template "fancypage.html" not found." Responses to a similar question on stack overflow pointed out that the problem may be related to loading static files with Crow. I tried one user's response of using the absolute path instead of the relative path which did not work. I also tried using the Crow function "set_static_file_info" as shown in the following:
CROW_ROUTE(app, "/")
([](const crow::request&, crow::response& res) {
//replace fancypage.html with your file path
res.set_static_file_info("fancypage.html");
res.end();
});
but I received "Error 404" on my page.