comparison scid/http.c @ 23:2cb228f23f53

misc: rework todo/jobs HTTP requests
author David Demelier <markand@malikania.fr>
date Thu, 21 Jul 2022 21:55:02 +0200
parents f98ea578b1ef
children 34cbbd215ef7
comparison
equal deleted inserted replaced
22:dd078aea5d02 23:2cb228f23f53
25 25
26 #include <kcgi.h> 26 #include <kcgi.h>
27 27
28 #include "http.h" 28 #include "http.h"
29 #include "log.h" 29 #include "log.h"
30 #include "page.h" 30 #include "page-api-jobs.h"
31 #include "page-api-projects.h" 31 #include "page-api-projects.h"
32 #include "page-api-todo.h" 32 #include "page-api-todo.h"
33 #include "page-api-workers.h" 33 #include "page-api-workers.h"
34 #include "page.h"
34 35
35 enum page { 36 enum page {
36 PAGE_API, 37 PAGE_API,
37 PAGE_LAST /* Not used. */ 38 PAGE_LAST /* Not used. */
38 }; 39 };
42 { 43 {
43 static const struct { 44 static const struct {
44 const char *prefix; 45 const char *prefix;
45 void (*handler)(struct kreq *); 46 void (*handler)(struct kreq *);
46 } apis[] = { 47 } apis[] = {
48 { "v1/jobs", page_api_v1_jobs },
49 { "v1/projects", page_api_v1_projects },
47 { "v1/todo", page_api_v1_todo }, 50 { "v1/todo", page_api_v1_todo },
48 { "v1/projects", page_api_v1_projects },
49 { "v1/workers", page_api_v1_workers }, 51 { "v1/workers", page_api_v1_workers },
50 { NULL, NULL } 52 { NULL, NULL }
51 }; 53 };
52 54
53 for (size_t i = 0; apis[i].prefix; ++i) 55 for (size_t i = 0; apis[i].prefix; ++i)