Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/porplax/eatcook.
Simple HTTP Server that uses socket.
https://github.com/porplax/eatcook.
html html5 http http-server json python python-3 routing
Last synced: 5 days ago
JSON representation
Simple HTTP Server that uses socket.
- Host: GitHub
- URL: https://github.com/porplax/eatcook.
- Owner: porplax
- Created: 2022-08-13T12:57:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-24T12:25:52.000Z (about 2 years ago)
- Last Synced: 2023-03-11T01:38:37.099Z (over 1 year ago)
- Topics: html, html5, http, http-server, json, python, python-3, routing
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# eatcook.
```python
pip install eatcook
```Eatcook is a simple socket HTTP server. With the ablity to run python files at interpret them as html. (Like CGI)
The server also provides a extremely easy way to create sub pages. Using `routebook.json` to redirect users to them`routebook.json:`
```json
{
"/", "index.html"
}
```
OR
```json
{
"/", "index.py"
}
```To get 404 page, place a file named `404.html` in the folder in which you're running in.
# Running at CLI
```
py -m eatcook --host 127.0.0.1 --port 8000 --folder (where http files are located)
```
Host & Port will run at 127.0.0.1:8000 by default if none are given.Folder will also run in the directory of which you're working in if none are given: `./`
# Running in python
```py
import eatcookeatcook.run(host, port, folder) # Runs eatcook.
```To run python scripts as html:
```py
import randomgenerated = random.randint(1,100000)
print(f"{generated}
") # Sends a generated number to client's browser.
```### Information
Eatcook doesn't have the ablity to serve `.css` files. Though, I might muster up the courage to try 👀