Responce ClassΒΆ
- write (std::string append_message)
Add a message to the write stack This is for text based messages (not binary etc) Paramaters: - append_message - The message to write to the client returns int
- writeBinary (char *binaryData, int length)
Registars a path along with its callback function Paramaters: - binaryData - The binary data. This needs to be a char * - length - the length of the binaryData returns int
- html (std::string location, HTMLContent content[], int arrayLength)
Serves a HTML page Paramaters: - location - location inside the views/ folder - content[] - the array for subsitution - arrayLength - the length of the array TODO: - The arrayLength paramater should be dropped returns void
- header(std::string type, std::string value)
Adds headers to the responce Paramaters: - type - The header name - value - The value of the header Example: - The function res.header("Content-Type", "plain/text"); would add "Content-Type: plain/text" to the HTTP responce returns int
- contentType(std::string content_type)
Quick way of defining the ContentType header Paramaters: - content_type - the value to assign to the ContentType Header returns int
- send(std::string http_code)
Sends the HTTP Responce. After this function is called Paramaters: - http_code - the HTTP code that will be sent with the responce TODO: - change the http_code from a std::string to int returns int