mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 16:24:07 +02:00
move http.h into http/
This commit is contained in:
parent
33ea563354
commit
944e597cb8
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "db.h"
|
||||
#include "http.h"
|
||||
#include "http/http.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "../controllers.h"
|
||||
#include "../http_server.h"
|
||||
#include "../models_json.h"
|
||||
#include "../str_util.h"
|
||||
|
||||
@ -10,17 +9,16 @@ void route_get_cart_items_from_session(HttpCtx* ctx)
|
||||
if (!session)
|
||||
return;
|
||||
|
||||
|
||||
CartItemVec cart_items;
|
||||
cart_item_vec_construct(&cart_items);
|
||||
|
||||
DbRes db_res = db_cart_items_with_user_id(cx->db, &cart_items, session->user_id);
|
||||
DbRes db_res
|
||||
= db_cart_items_with_user_id(cx->db, &cart_items, session->user_id);
|
||||
if (db_res != DbRes_Ok) {
|
||||
RESPOND_BAD_REQUEST(ctx, "Could not find cart for user");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String res;
|
||||
string_construct(&res);
|
||||
|
||||
@ -35,7 +33,6 @@ void route_get_cart_items_from_session(HttpCtx* ctx)
|
||||
}
|
||||
string_push_str(&res, "]}");
|
||||
|
||||
|
||||
cart_item_vec_destroy(&cart_items);
|
||||
RESPOND_JSON(ctx, 200, "%s", res.data);
|
||||
string_destroy(&res);
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "../controllers.h"
|
||||
#include "../http.h"
|
||||
#include "../http/http.h"
|
||||
#include "../models_json.h"
|
||||
|
||||
void route_get_index(HttpCtx* ctx)
|
||||
{
|
||||
Cx* cx = http_ctx_user_ctx(ctx);
|
||||
|
||||
RESPOND_HTML(ctx, 200,
|
||||
RESPOND_HTML(ctx,
|
||||
200,
|
||||
"<!DOCTYPE html><html><head><meta "
|
||||
"charset=\"utf-8\"></head><body><h1>Number = %d</h1></body></html>",
|
||||
cx->number);
|
||||
@ -39,7 +40,8 @@ l0_return:
|
||||
|
||||
void route_get_not_found(HttpCtx* ctx)
|
||||
{
|
||||
RESPOND_HTML(ctx, 404,
|
||||
RESPOND_HTML(ctx,
|
||||
404,
|
||||
"<!DOCTYPE html><html><head><meta "
|
||||
"charset=\"utf-8\"></head><body><center><h1>404 Not "
|
||||
"Found</h1><code style=\"font-size: 1rem;\">GET "
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../controllers.h"
|
||||
#include "../http.h"
|
||||
#include "../http/http.h"
|
||||
#include "../models_json.h"
|
||||
#include "../str_util.h"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../controllers.h"
|
||||
#include "../http.h"
|
||||
#include "../http/http.h"
|
||||
#include "../models_json.h"
|
||||
#include "../str_util.h"
|
||||
#include <string.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../controllers.h"
|
||||
#include "../http.h"
|
||||
#include "../http/http.h"
|
||||
#include "../models_json.h"
|
||||
#include "../str_util.h"
|
||||
#include <string.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "server.h"
|
||||
#include "../http.h"
|
||||
#include "../str_util.h"
|
||||
#include "http.h"
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
#include <pthread.h>
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../collection.h"
|
||||
#include "../http.h"
|
||||
#include "client_connection.h"
|
||||
#include "http.h"
|
||||
#include "packet.h"
|
||||
#include "request.h"
|
||||
#include "worker.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../http.h"
|
||||
#include "client_connection.h"
|
||||
#include "http.h"
|
||||
#include <bits/pthreadtypes.h>
|
||||
|
||||
typedef struct {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "controllers.h"
|
||||
#include "db_sqlite.h"
|
||||
#include "http.h"
|
||||
#include "http/http.h"
|
||||
#include "json.h"
|
||||
#include "models.h"
|
||||
#include "models_json.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user