A simple, authenticated pastebin in Flask.
| Endpoint | Method | Authenticated | Description |
|---|---|---|---|
/login |
POST |
No | Log in. |
/register |
POST |
No | Register a new user. |
/paste |
POST |
Yes | Upload a paste. |
/retrieve/<ID> |
GET |
No | Retrieve a paste by ID. |
/list |
GET |
No | Get a list of all pastes. |
- All data sent to any endpoint must be JSON. All data returned will likewise be JSON.
/loginand/registerrequire the data to include fields forusernameandpassword./pasterequires fields fortitleandcontent.- Authenticated endpoints require an
Authorizationheader with valueBearer <TOKEN>, where<TOKEN>is the JSON Web Token returned by/login.
For testing purposes, you can simply install the dependencies and run app.py directly:
$ pip install -r requirements.txt
$ python app.pyTo deploy to a production environment (at your own risk), build a Docker image:
$ docker build -t pasteflask .
$ docker run -p 5000:5000 pasteflaskBy default, this API will run on port 5000. To change this, adjust your port mapping when you run the Docker image.