mongoose/examples/device-dashboard/main.c

25 lines
761 B
C
Raw Normal View History

2022-05-13 23:47:10 +08:00
// Copyright (c) 2020-2022 Cesanta Software Limited
2020-12-05 19:26:32 +08:00
// All rights reserved
#include "mongoose.h"
2023-02-23 03:38:21 +08:00
2022-06-05 21:59:59 +08:00
const char *s_listening_url = "http://0.0.0.0:8000";
2023-02-23 03:38:21 +08:00
const char *s_listening_surl = "https://0.0.0.0:8443";
2020-12-05 19:26:32 +08:00
2022-05-15 21:40:58 +08:00
void device_dashboard_fn(struct mg_connection *, int, void *, void *);
2020-12-05 19:26:32 +08:00
int main(void) {
struct mg_mgr mgr;
2022-08-01 18:19:32 +08:00
mg_log_set(MG_LL_DEBUG); // Set debug log level
2020-12-05 19:26:32 +08:00
mg_mgr_init(&mgr);
mg_http_listen(&mgr, s_listening_url, device_dashboard_fn, NULL);
2022-06-05 21:59:59 +08:00
MG_INFO(("Listening on %s", s_listening_url));
2023-02-23 03:38:21 +08:00
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
mg_http_listen(&mgr, s_listening_surl, device_dashboard_fn, "");
MG_INFO(("Listening on %s", s_listening_surl));
#endif
2022-06-05 21:59:59 +08:00
while (mgr.conns != NULL) mg_mgr_poll(&mgr, 500);
2022-05-15 21:40:58 +08:00
mg_mgr_free(&mgr);
2020-12-05 19:26:32 +08:00
return 0;
}