cpp-httplib
cpp-httplib copied to clipboard
Static directory configuration
Hi, I configured the static directory as per the example but was unsuccessful due to the first use, looked at the issues and did not find a solution. Hope to be able to get help, thank you
#include <iostream>
#include <httplib.h>
using namespace std;
using namespace httplib;
int main(void)
{
Server svr;
svr.Get("/", [&](const Request &req, Response &res)
{ svr.set_mount_point("/", "../resource"); });
// or so? I don't know how to configure it 🤦♂️
svr.set_mount_point("/", "../resource");
svr.listen("0.0.0.0", 3000);
return 0;
}
Please see the following code. Hope it helps.
Server svr;
// Mount / to ./www directory
auto ret = svr.set_mount_point("/", "./www");
if (!ret) {
// The specified base directory doesn't exist...
}