Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
StaticView.h
Go to the documentation of this file.
1#pragma once
2
4#include "http/HttpRequest.h"
5#include "http/HttpResponse.h"
6
8
13{
14public:
15 explicit StaticView(const char *html) : html_(html) {}
16
17 std::string render(const std::map<std::string, std::string> & = {}) const override
18 {
19 return html_;
20 }
21
22 std::string getContentType() const override
23 {
24 return "text/html";
25 }
26
27private:
28 const char *html_;
29};
Abstract base class for all views in the PicoFramework.
Defines the HttpRequest class for handling HTTP requests: headers, method, path, query string,...
HTTP HttpResponse class for managing status, headers, body, and streaming support.
StaticView sends a fixed HTML string with no template substitution.
Definition StaticView.h:13
const char * html_
Definition StaticView.h:28
std::string render(const std::map< std::string, std::string > &={}) const override
Render the view body.
Definition StaticView.h:17
std::string getContentType() const override
Return the MIME content type for this view.
Definition StaticView.h:22
StaticView(const char *html)
Definition StaticView.h:15