This is just a practice project
TCP serverHTTP responseparse request start-line- parse path query
parse request headers(not sure if there are any bug)parse request datamultithreadmore HTTP status code- HTTPS
- route matching
- middleware
- static directory
#include <httpserver.h>
void root(HTTP_Request* req, HTTP_Response* res){
res_set_status(res, OK);
res_set_html(res,"public/index.html");
}
int main(int argc, char *argv[]){
create_server(5000);
handle_route("/",root);
start();
return 0;
}
Then type make
in terminal
The program will get compiled and output to out
Then you can type ./out/server
to run it!