aboutsummaryrefslogtreecommitdiffstats
path: root/src/endpoints.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/endpoints.c')
-rw-r--r--src/endpoints.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/endpoints.c b/src/endpoints.c
index d8efb0c..a4ac35a 100644
--- a/src/endpoints.c
+++ b/src/endpoints.c
@@ -31,7 +31,7 @@ do { \
const char *const JSON_ERROR = "{\"error\":\"%s\"}";
const char *const HTML_ERROR = "<!DOCTYPE html><html><body>Error: %s</body></html>";
-const char *HTTPHOSTNAME = "http://127.0.0.1";
+const char *HTTPHOSTNAME = "http://127.0.0.1:80";
struct global_args {
enum {
@@ -57,6 +57,12 @@ struct global_args parse_global_args(struct MHD_Connection *connection) {
return ret;
}
+void init(const char *db) {
+ sqlite_init(db);
+ const char *new_httphostname = getenv("HTTPHOSTNAME");
+ if (new_httphostname) HTTPHOSTNAME = new_httphostname;
+}
+
// index, path: /
struct MHD_Response *ENDP_(struct MHD_Connection* connection, int *status) {
return get_from_file("www/index.html");
@@ -109,8 +115,10 @@ exit:
// API, path: /api/linkdel
struct MHD_Response *ENDP_api_linkdel(const char *method, struct MHD_Connection *connection, int *status) {
-
+ return MHD_create_response_from_buffer(4, "TODO", MHD_RESPMEM_PERSISTENT);
}
// API, path: /api/linkget
-struct MHD_Response *ENDP_api_linkget(const char *method, struct MHD_Connection *connection, int *status) { }
+struct MHD_Response *ENDP_api_linkget(const char *method, struct MHD_Connection *connection, int *status) {
+ return MHD_create_response_from_buffer(4, "TODO", MHD_RESPMEM_PERSISTENT);
+}