This is a simple web server built using python built in 'http server' and 'socketserver' modules. It demonstrate how to handle 'POST' and 'GET' request without relying on any framework
This project was built to better understand the internals of web communication β how HTTP requests are handled and how responses are returned. It's a foundational step toward becoming a more efficient and informed backend developer.
- π₯ Handles GET requests on
/home - π€ Handles POST requests on
/away - π Responds with custom HTML messages
- β Handles unknown routes with proper error responses
- π§ Teaches the fundamentals of server-client interaction
- Clone the repository:
git clone https://github.com/your-username/simple-python-http-server.git cd simple-python-http-server
Run the server by: python3 server.py
Access the routes:
http://localhost:8000/home β GET request
http://localhost:8000/away β POST request (use Postman, curl or insomnia)
π§ Why I Built This As a backend developer, I wanted to understand the core workings of HTTP β beyond what Flask or Django abstracts away. This project helped me explore:
The TCP layer
HTTP headers and response codes
Request routing without a framework
This understanding strengthens my ability to build, debug, and optimize web apps in production environments.
βοΈ Tech Stack Language Description π Python Core programming language π SocketServer For TCP connection handling π‘ HTTPServer For processing HTTP requests
π Project Structure pgsql Copy Edit simple-python-http-server/ β βββ server.py # Main server file βββ README.md # Project overview
π¨βπ» Author Sakyi Mustapha
π§ Email: sakyimustapha@gmail.com
π Future Improvements Parse POST request body (e.g., JSON or form data)
Serve HTML files instead of raw strings
Log incoming requests with timestamps
Add unit tests for route handling