An open API service indexing awesome lists of open source software.

https://github.com/veggiedefender/http-server

A minimal HTTP server implemented from scratch using Python sockets and threads
https://github.com/veggiedefender/http-server

Last synced: 8 months ago
JSON representation

A minimal HTTP server implemented from scratch using Python sockets and threads

Awesome Lists containing this project

README

          

# http-server

A minimal, probably-definitely-not-RFC-compliant HTTP server with an almost
flask-ish API implemented from scratch using Python sockets and threads

Don't use this for anything serious.

* There is no live demo because I'm scared to put it online.

# [API Docs](https://github.com/veggiedefender/http-server/blob/master/API.md)

Found here:

https://github.com/veggiedefender/http-server/blob/master/API.md

## Dependencies
Zero outside of the standard library, of which this project only uses `socket` and `threading`.

This means you can clone and run this right away!

**Note:** Use python 3.6 or higher, because this uses [f-strings](https://www.python.org/dev/peps/pep-0498/).

## Running
```
$ python app.py
```

## What do you mean "flask-ish?"
It looks kind of like Flask on the surface (mainly the decorator based routing)

#### Flask:
```python
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
return "Hello World!"
```

#### This thing:
```python
from server import Server
app = Server()

@app.route("/")
def hello(request, response):
response.body = "Hello World!"
```

## Limitations
* Does not implement all or most of HTTP
* Pretty bad at the parts of HTTP it does implement
* Super brittle, probably
* See [issues](https://github.com/veggiedefender/http-server/issues)