From 78bf2fe4a5bf37514f6dfd203ef969da0bf40c2e Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 22 Sep 2025 17:32:44 +0200 Subject: Setup project skeleton --- login_get.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 login_get.c (limited to 'login_get.c') diff --git a/login_get.c b/login_get.c new file mode 100644 index 0000000..0699cbc --- /dev/null +++ b/login_get.c @@ -0,0 +1,49 @@ +#define _POSIX_C_SOURCE 200809L + +#include "endpoints.h" +#include "defs.h" +#include + +#define LOGIN_BODY \ + "
\n" \ + " " PROJECT_NAME ", " \ + PROJECT_DESC "\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + " \n" \ + "
\n" \ + " \n" \ + "
\n" + +int ep_login_get(const struct http_payload *const p, + struct http_response *const r, void *const user) +{ + static const char body[] = + DOCTYPE_TAG + "\n" + " \n" + " " STYLE_A "\n" + " " COMMON_HEAD "\n" + " \n" + " " LOGIN_BODY "\n" + "\n"; + + *r = (const struct http_response) + { + .status = HTTP_STATUS_OK, + .buf.ro = body, + .n = sizeof body - 1 + }; + + if (http_response_add_header(r, "Content-Type", "text/html")) + { + fprintf(stderr, "%s: http_response_add_header failed\n", __func__); + return -1; + } + + return 0; +} -- cgit v1.2.3