Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/syqu22/flask-pastebin

Simple flask web application
https://github.com/syqu22/flask-pastebin

bootstrap5 flask flask-login flask-sqlalchemy flask-wtf jinja2 mysql pastebin pytest python

Last synced: 30 days ago
JSON representation

Simple flask web application

Awesome Lists containing this project

README

        

# 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:
```sh
$ git clone https://github.com/syqu22/flask-pastebin.git
```

Then install all required libraries through:

```bash
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

```http
GET /api/users/${id}
```

| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `id` | `int` | **Required**. Id of user to fetch |

#### Get users

```http
GET /api/users
```

| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `page` | `int` | Used to paginate (one page returns maximum of 50 users)|

#### Get pastebins of user

```http
GET /api/users/${id}/pastebins
```

| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `id` | `int` | **Required**. Id of user to fetch |

#### Get pastebin

```http
GET /api/pastebins/${id}
```

| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `id` | `int` | **Required**. Id of pastebin to fetch |

#### Get pastebins

```http
GET /api/pastebins
```

| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `id` | `int` | Used to paginate (one page returns maximum of 50 pastebins) |