A simple web server, using boost.
To run server:
$ make
$ sudo ./webserver config
To run unit tests and get coverage:
$ make unit_test_coverage
To run integration test:
$ make integration_test
To clean up:
$ make clean
Use your browser to view pages:
- Echo server:
http://localhost:8080/echo/
- Static file server:
http://localhost:8080/static/image0.jpg
- Static file server for markdown:
http://localhost:8080/markdown/README.md
- Status server:
http://localhost:8080/status/
- Database interface:
http://localhost:8080/database/index.html
Webserver
: A webserver is responsible for listening to sockets, accepting connections, processing requests, generating responses and replying to client.Request
: The request follows the common API. It can be generated by parsing the raw_request string.Response
: The response follows the common API.RequestHandler
: The RequestHandler follows the common API.EchoHandler
: An EchoHandler inherites from RequestHandler. It echos back the raw request received.StaticHandler
: A StaticHandler inherites from RequestHandler. It servers static files.NotFoundHandler
: A NotFoundHandler inherites from RequestHandler. It responds the 404 messsge.StatusHandler
: A StatusHandler inherites from RequestHandler. It displays information on the status of the web server.Log
: A singleton class that serves as a log which the server and different handlers can write to the status information and then the status handler can read from to construct the response message.
The unit tests for each class and an integration test in python can be found in tests folder.