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