Simple HTTP Server

Repository build status:

Rus documentation available here

Build

make all

Run

./server

Static files

You can add static files to the static directory. They will be automatically processed and mapped to url paths

Development

Controller mappings

There is a simple controller mapping:

  POST_MAPPING("/") {
    puts("HTTP/1.1 200 OK\r\n\r\n");
    puts("Post request received\r\n");
    puts("Fetch the data using `payload` variable.");
  }
  POST_MAPPING("/anime") {
    puts("HTTP/1.1 200 OK\r\n\r\n");
    puts("Wanna see anime?");
  }

Feel free to use some util functions:

  POST_MAPPING("/anime") {
    response_ok();
    puts("Wanna see anime?");
  }

Server static files and another media

To add static files put them on the static folder. Authomaticly all files will be served as text/html files except of css

If you want to map some controller don’t forget to use HTTP header for response. There is some methods to do this:

response_ok();

or

response_media_css();