Skip to content

haywalk/pasteflask

Repository files navigation

Pasteflask

A simple, authenticated pastebin in Flask.

API Specification

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.

Notes

  • All data sent to any endpoint must be JSON. All data returned will likewise be JSON.
  • /login and /register require the data to include fields for username and password.
  • /paste requires fields for title and content.
  • Authenticated endpoints require an Authorization header with value Bearer <TOKEN>, where <TOKEN> is the JSON Web Token returned by /login.

Running the API

For testing purposes, you can simply install the dependencies and run app.py directly:

$ pip install -r requirements.txt
$ python app.py

To deploy to a production environment (at your own risk), build a Docker image:

$ docker build -t pasteflask .
$ docker run -p 5000:5000 pasteflask

By default, this API will run on port 5000. To change this, adjust your port mapping when you run the Docker image.

About

Flask-based pastebin backend with authenticated uploads.

Topics

Resources

License

Stars

Watchers

Forks