Skip to content

mash20-dot/web-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

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

πŸ“Œ Project Overview

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.

πŸ› οΈ Features

  • πŸ“₯ 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

πŸ§ͺ How to Run

  1. 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

πŸ”— LinkedIn: https://www.linkedin.com/in/sakyi-mustapha-958438367?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3Br1SJBbVXQcSWTvFeRu6nrw%3D%3D

🏁 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages