https://github.com/dynstat/simplest-http-server-py
This project is a simple Python-based HTTP server that serves a static web page with CSS and JavaScript, supporting HTTP GET requests and basic CORS.
https://github.com/dynstat/simplest-http-server-py
Last synced: 11 months ago
JSON representation
This project is a simple Python-based HTTP server that serves a static web page with CSS and JavaScript, supporting HTTP GET requests and basic CORS.
- Host: GitHub
- URL: https://github.com/dynstat/simplest-http-server-py
- Owner: dynstat
- Created: 2024-03-23T04:46:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-27T20:27:24.000Z (about 2 years ago)
- Last Synced: 2025-03-27T02:46:10.624Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
***Note:** Just for learning purposes, not intended or safe to be used for real web applications.*
# Simple HTTP Server in Python
This repository contains a basic implementation of an HTTP server using Python's socket programming. The server is just capable of handling HTTP GET requests and responding with a simple HTML page. Additionally, it includes basic CORS (Cross-Origin Resource Sharing) support to allow requests from different origins.
## Features
- **HTTP GET Request Handling:** The server processes HTTP GET requests and returns a predefined HTML response, including CSS and JavaScript files.
- **Interactive Web Page:** Includes a simple interactive web page with a click counter, demonstrating how to serve static files (HTML, CSS, JavaScript) and handle user interactions.
- **CORS Support:** Implements basic CORS headers to allow cross-origin requests.
- **Connection Handling:** Manages client connections, receiving requests, and sending responses using Python's low-level socket API.
## Getting Started
### Prerequisites
- Python 3.x installed on your machine.
### Running the Server
1. Windows OS
```powershell
python httpserver.py
```
2. Linux or Mac
```bash
python3 httpserver.py
```