https://github.com/emeleonufavour/http-server
A HTTP server built with Python to handle GET and POST requests.
https://github.com/emeleonufavour/http-server
Last synced: 3 months ago
JSON representation
A HTTP server built with Python to handle GET and POST requests.
- Host: GitHub
- URL: https://github.com/emeleonufavour/http-server
- Owner: emeleonufavour
- Created: 2024-05-04T10:17:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-08T22:25:39.000Z (10 months ago)
- Last Synced: 2024-08-10T00:37:26.253Z (10 months ago)
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP Server
A HTTP server implementation in Python using TCP protocol for Socket communication. This server is able to handle GET and POST requests
## Requirements
- Python 3.x
## Usage
1. Clone this repository:
```bash
git clone https://github.com/your-username/simple-http-server.git
```2. Navigate to the directory containing the `main.py` file:
```bash
cd http-server
```3. Run the server:
```bash
python main.py
```4. The HTTP server will run on port 4221. You can check for server connection by running
the following command on a different terminal.```bash
nc -vz 127.0.0.1 4221
```5. To perform a POST request, make sure the server is running and on a different terminal run
the following command.```bash
curl -vvv -d "Greetings from the second terminal" localhost:4221/files/readme.txt
```You should see a new file "readme.txt" created in your project directory with the content as the content being passed in the POST request.
## Customization
- You can customize the behavior of the server by modifying the `main.py` file. For example, you can add support for other HTTP methods, or implement additional functionality.