Rewrite in C. Simple TCP listener.

This commit is contained in:
2025-09-13 00:57:47 +03:00
parent 418d33a6de
commit 39db2830e2
9 changed files with 149 additions and 77 deletions

20
app/main.c Normal file
View File

@@ -0,0 +1,20 @@
//
// Created by nazar on 12.09.2025.
//
#include "main.h"
#include <stdio.h>
struct HttpResponse* handleRequest(struct HttpRequest* request)
{
struct HttpResponse* http_response = {};
return http_response;
}
int main() {
struct HttpServer http_server;
printf("Starting the server...\n");
start_http_server(&http_server, ADDRESS, PORT);
printf("Bye!\n");
return 0;
}

View File

@@ -1,8 +0,0 @@
#include <print>
#include "../src/server.hpp"
int main() {
SimpleHttpServer server;
server.start_listening(8080);
std::println("Bye!");
}

16
app/main.h Normal file
View File

@@ -0,0 +1,16 @@
//
// Created by nazar on 12.09.2025.
//
#ifndef SIMPLEHTTPSERVER_MAIN_H
#define SIMPLEHTTPSERVER_MAIN_H
#include "../src/httpserver.h"
#define ADDRESS "127.0.0.1"
#define PORT 8080
struct HttpResponse* handleRequest(struct HttpRequest* request);
int main();
#endif //SIMPLEHTTPSERVER_MAIN_H