load html file during compile time
This commit is contained in:
parent
552e085282
commit
81fabcb537
@ -1,9 +1,11 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
#include <http/server.h>
|
#include <http/server.h>
|
||||||
#include <nvs/nvs.h>
|
#include <nvs/nvs.h>
|
||||||
#include <wifi/wifi.h>
|
#include <wifi/wifi.h>
|
||||||
|
|
||||||
|
const http::response_t text_html = {
|
||||||
|
#include "res/test.html"
|
||||||
|
};
|
||||||
|
|
||||||
void start_ap() {
|
void start_ap() {
|
||||||
nvs::init();
|
nvs::init();
|
||||||
@ -36,10 +38,12 @@ void start_http_server() {
|
|||||||
// TODO
|
// TODO
|
||||||
}});
|
}});
|
||||||
http::set_handlers({{http::Method::get, "/",
|
http::set_handlers({{http::Method::get, "/",
|
||||||
[]() {
|
[]() {
|
||||||
return http::response_t{
|
return text_html;
|
||||||
"<html><body style=\"background:black; color: "
|
//http::response_t("res/test.html")
|
||||||
"white\">Home</body></html>"};
|
//http::response_t{
|
||||||
|
// "<html><body style=\"background:black; color: "
|
||||||
|
// "white\">Home</body></html>"};
|
||||||
}},
|
}},
|
||||||
{http::Method::get, "/hello1",
|
{http::Method::get, "/hello1",
|
||||||
[]() {
|
[]() {
|
||||||
|
|||||||
5
res/test.html
Normal file
5
res/test.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
"<html>"
|
||||||
|
"<body style=\"background:black; color: white\">"
|
||||||
|
"Home"
|
||||||
|
"</body>"
|
||||||
|
"</html>"
|
||||||
Loading…
Reference in New Issue
Block a user