Rewrite in C. Simple TCP listener.
This commit is contained in:
20
app/main.c
Normal file
20
app/main.c
Normal 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;
|
||||
}
|
||||
@@ -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
16
app/main.h
Normal 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
|
||||
Reference in New Issue
Block a user