diff --git a/include/kqm/defs.h b/include/kqm/defs.h index b37f67a..8543214 100644 --- a/include/kqm/defs.h +++ b/include/kqm/defs.h @@ -1,8 +1,8 @@ -#ifndef DEFS_H -#define DEFS_H +#ifndef KQM_DEFS_H +#define KQM_DEFS_H #define CR "\r" #define LF "\n" #define CRLF "\r\n" -#endif // DEFS_H +#endif // KQM_DEFS_H diff --git a/include/kqm/types.h b/include/kqm/types.h index 64232fc..ddcfe3d 100644 --- a/include/kqm/types.h +++ b/include/kqm/types.h @@ -1,5 +1,5 @@ -#ifndef TYPES_H -#define TYPES_H +#ifndef KQM_TYPES_H +#define KQM_TYPES_H #include @@ -8,4 +8,4 @@ typedef struct mg_context mg_context; typedef struct mg_connection mg_connection; typedef struct mg_request_info mg_request_info; -#endif // TYPES_H +#endif // KQM_TYPES_H diff --git a/src/main.c b/src/main.c index 471974d..3b7325a 100644 --- a/src/main.c +++ b/src/main.c @@ -6,26 +6,18 @@ #include #include -static int request_handler(mg_connection* conn, void* cbdata) -{ - mg_printf(conn, - "HTTP/1.1 200 OK" CRLF "Content-Type: text/plain" CRLF "Connection: close" CRLF CRLF "Hello, World!"); - return 200; -} - int main(int argc, char** argv) { - const char* options[] = {"document_root", ".", "listening_ports", "8080", NULL}; + const char* options[] = {"document_root", "./www", "listening_ports", "8080", NULL}; mg_callbacks callbacks; mg_context* ctx; memset(&callbacks, 0, sizeof(callbacks)); ctx = mg_start(&callbacks, NULL, options); - mg_set_request_handler(ctx, "/", request_handler, NULL); + // mg_set_request_handler(ctx, "/", request_handler, NULL); printf("Server started on port(s) %s\n", mg_get_option(ctx, "listening_ports")); getchar(); mg_stop(ctx); - } diff --git a/xmake.lua b/xmake.lua index d149017..de7e415 100644 --- a/xmake.lua +++ b/xmake.lua @@ -13,3 +13,15 @@ target("math") add_packages("civetweb") add_includedirs("include") add_files("src/main.c") + + after_build(function (target) + local npm = "npm" + if is_host("windows") then + npm = "npm.cmd" + end + os.execv(npm, {"--prefix", "ui", "run", "build"}) + + local vue_dist_dir = "ui/dist" + local target_dir = target:targetdir() .. "/www" + os.cp(vue_dist_dir, target_dir) + end)