https://github.com/nugaon/python3-http-server-example
Simple example for http server in python3
https://github.com/nugaon/python3-http-server-example
Last synced: 7 days ago
JSON representation
Simple example for http server in python3
- Host: GitHub
- URL: https://github.com/nugaon/python3-http-server-example
- Owner: nugaon
- Created: 2020-04-23T17:16:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-23T17:58:04.000Z (about 6 years ago)
- Last Synced: 2025-11-27T09:17:24.036Z (7 months ago)
- Language: Python
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python3 Simple HTTP server
This project is an example how you can create a HTTP server in python3
# Manual test
For manual testing the preferred tool is 'curl', and the server has only one EP
to make calls, so the only command which can be useful with that is:
```
curl \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X POST -d '{
"sortKeys": ["fruits", "numbers"],
"payload": {
"fruits": ["watermelon", "apple", "pineapple"],
"numbers": [1333, 4, 2431, 7],
"colors": ["green", "blue", "yellow"]
}
}' 127.0.0.1:8080/sort
```
# Run
## Build
Build can be made by 'pyinstaller'. Binary files will be in the dist directory
## Docker
To try out it in docker, run:
> docker run -d --rm --name python-http-server --network host -v "$PWD":/usr/src/app python:3 python /usr/src/app/server.py