Closed Sampozzo closed 2 years ago
You can do something like this:
void serveIndex(Request &req, Response &res) {
if (res.statusSent()) {
return;
}
return static_index(req, res);
}
and then add
app.get(&serveIndex);
as the last middleware after all other routes.
I have not tested this code but I have done it before in the past. Let me know if it works for you.
Another option is to use:
app.notFound(&static_index);
but this way it will not make any difference between GET and other HTTP methods.
Yes! It works! Thank you very much!
Hello, i'm using your library in my project and i like it very much, thank you for your work! I'm building a project with an angular client flashed with your aWOT-scripts and it works very amazing.
I have a static webserver at root that serve the angular client, and a Json server listening at /api:
I need to create a rewrite for every request that isn't /api that point to index.html of the static files, like i can do with nginx rewrites:
example, i want that http://myip/edit-config rewrite to http://myip/. Can you hep please?
Thank you and sorry for my english!