File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1780,6 +1780,25 @@ void start_server(SDParams params) {
17801780 res.set_redirect (" /index.html" );
17811781 });
17821782
1783+ svr->Get (" /dev-index" , [](const httplib::Request& req, httplib::Response& res) {
1784+ try {
1785+ std::string def_frontend_path = " examples/server/frontend.html" ;
1786+ std::string html = " " ;
1787+ std::ifstream file (def_frontend_path);
1788+ if (file.is_open ()) {
1789+ std::stringstream buffer;
1790+ buffer << file.rdbuf ();
1791+ html = buffer.str ();
1792+ file.close ();
1793+ } else {
1794+ html = " Error: Unable to open file " + def_frontend_path;
1795+ }
1796+ res.set_content (html, " text/html" );
1797+ } catch (const std::exception& e) {
1798+ res.set_content (" Error loading page" , " text/plain" );
1799+ }
1800+ });
1801+
17831802 // bind HTTP listen port, run the HTTP server in a thread
17841803 if (!svr->bind_to_port (params.host , params.port )) {
17851804 // TODO: Error message
You can’t perform that action at this time.
0 commit comments