MythTV  master
Static Public Member Functions | List of all members
MythHTTPRewrite Class Reference

#include <mythhttprewrite.h>

Static Public Member Functions

static HTTPResponse RewriteFile (const HTTPRequest2 &Request, const QString &File)
 A convenience method to seemlessly redirect requests for files to a context specific file. More...
 
static HTTPResponse RewriteToSPA (const HTTPRequest2 &Request, const QString &File)
 A convenience method to seemlessly redirect requests to a Single Page web app (SPA) More...
 

Detailed Description

Definition at line 7 of file mythhttprewrite.h.

Member Function Documentation

◆ RewriteFile()

HTTPResponse MythHTTPRewrite::RewriteFile ( const HTTPRequest2 Request,
const QString &  File 
)
static

A convenience method to seemlessly redirect requests for files to a context specific file.

e.g. we want requests for /main.js to be served from /apps/backend/main.js

auto main_js = [](auto && PH1) { return MythHTTPRewrite::RewriteFile(std::forward<decltype(PH1)>(PH1), "apps/backend/main.js"); };
MythHTTPService::AddHandlers( {{"/main.js", main_js }});

Definition at line 22 of file mythhttprewrite.cpp.

Referenced by run_backend(), and run_setup_webserver().

◆ RewriteToSPA()

HTTPResponse MythHTTPRewrite::RewriteToSPA ( const HTTPRequest2 Request,
const QString &  File 
)
static

A convenience method to seemlessly redirect requests to a Single Page web app (SPA)

e.g. we want all requests not handled by API or static methods to be sent into the web app

auto spa_index = [](auto && PH1) { return MythHTTPRewrite::RewriteToSPA(std::forward<decltype(PH1)>(PH1), "apps/backend/index.html"); };
MythHTTPService::AddErrorPageHandler( {{"=404", spa_index }});

Definition at line 50 of file mythhttprewrite.cpp.

Referenced by run_backend(), and run_setup_webserver().


The documentation for this class was generated from the following files:
MythHTTPRewrite::RewriteFile
static HTTPResponse RewriteFile(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests for files to a context specific file.
Definition: mythhttprewrite.cpp:22
MythHTTPRewrite::RewriteToSPA
static HTTPResponse RewriteToSPA(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests to a Single Page web app (SPA)
Definition: mythhttprewrite.cpp:50