Add option to use CORS
Fix README formatting
Add license
This is a Python Flask application which provides a simple HTTP API for storing and retrieving UTF-8 strings.
The Content-Type header of requests and responses must be
text/plain; charset=UTF-8
.
GET /new
Returns the ID of a new string store in the response body.
POST /s/<id>
Set the string with the given ID to the string in the request body.
If the given ID is not already in use the server will return a 404 Not Found
error.
The Server may reject strings it deems too long by returning a 413 Payload Too Large
error.
GET /s/<id>
Returns the string with the given ID in the response body.
Requirements:
Clone the repository and change to it's directory.
$ python -c "import server; server.setup_database()"
$ export FLASK_APP=server.py
$ flask run
Or you can use a different WSGI server. You may edit the constants at the start of server.py to your liking.
$ curl 'http://example.org/new'
Ig7WRA4w
$ 'http://example.org/s/Ig7WRA4w' -H "Content-Type: text/plain; charset=UTF-8" -d "Hello, World!"
success
$ curl 'http://example.org/s/Ig7WRA4w'
Hello, World!