Skip to content

Latest commit

 

History

History
108 lines (72 loc) · 2.66 KB

README.md

File metadata and controls

108 lines (72 loc) · 2.66 KB

flask-pastebin

This is my first Flask project. I wanted to do pastebin web application to learn about Python and Web Applications. Technology I have used:

  • Flask
  • Flask-WTF for forms and validation
  • Flask-SQLAlchemy for Database functionality
  • Flask-Login for user authentication
  • Pytest for testing
  • Jinja2 + Bootstrap 5 for Templates

Features

  • Publish public or private pastebins
  • Paste expiration
  • User privalges to view/edit/delete his own pastebins
  • Syntax highlighting
  • View recently created public pastebins
  • Fetch all data through simple API

Screenshots

Installation

First clone the repository to use it localy:

$ git clone https://github.com/syqu22/flask-pastebin.git

Then install all required libraries through:

  pip install -r requirements.txt

There's already an user preloaded in database and you can access him with:

Login: test

Password: test123

There's also a special url /admin thanks to Flask-Admin, where you can have access to database from the website

API Reference

Get user

  GET /api/users/${id}
Parameter Type Description
id int Required. Id of user to fetch

Get users

  GET /api/users
Parameter Type Description
page int Used to paginate (one page returns maximum of 50 users)

Get pastebins of user

  GET /api/users/${id}/pastebins
Parameter Type Description
id int Required. Id of user to fetch

Get pastebin

  GET /api/pastebins/${id}
Parameter Type Description
id int Required. Id of pastebin to fetch

Get pastebins

  GET /api/pastebins
Parameter Type Description
id int Used to paginate (one page returns maximum of 50 pastebins)