-
-
Save mathiasfls/d6d4ac2b82f8bc7c4463f596dbd092dc to your computer and use it in GitHub Desktop.
Minimal web server demo in Python (requires fastcore: `pip install fastcore`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastcore.utils import * | |
| host = 8888,'localhost' | |
| sock = start_server(*host) | |
| print(f'Serving on {host}...') | |
| while True: | |
| conn,addr = sock.accept() | |
| with conn: | |
| data = conn.recv(1024) | |
| print(data.decode()) | |
| conn.sendall(b"HTTP/1.1 200 OK\n\nHello, World!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment