Flask-Mongoengine RESTful API Example

Simple API example completed with Flask and MongoDB

This repository contains the example code for API project, using MongoEngine, Marshmallow with Flask built on Docker.

User account has to be created to use application. Only registered users can add boards, cards and comments. Entities may be deleted by owners only.

---
app/
├── requirements.txt
├── wsgi.py
├── Dockerfile
└── server
    ├── __init__.py
    ├── database
    │   ├── __init__.py
    │   ├── models.py
    │   └── schemas.py
    └── resources
        ├── __init__.py
        ├── auth.py
        ├── boards.py
        ├── cards.py
        └── comments.py
---
Method Route Description
GET / Index of application
POST /auth/register Register to application
POST /auth/login Login to applicaiton

API

Method Route Description
GET /boards/ List of boards
POST /boards/ Create a new board
GET /boards/{board_id} Get board details by ID
PUT /boards/{board_id} Update board details by ID
DELETE /boards/{board_id} Delete a board by ID
POST /boards/{board_id}/cards/ Add a new card to board

Cards

Method Route Description
GET /cards/{card_id} Get card details by ID
PUT /cards/{card_id} Update card details by ID
DELETE /cards/{card_id} Delete a card by ID

Comments

<table>
  <tr>
    <th>Method</th>
    <th>Route</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>GET</td>
    <td>/cards/{card_id}/comments/</td>
    <td>List of comments of card</td>
  </tr>
  <tr>
    <td>GET</td>
    <td>/cards/{card_id}/comments/{comment_id}</td>
    <td>Get comment details by ID</td>
  </tr>
    <tr>
    <td>POST</td>
    <td>/cards/{card_id}/comments/</td>
    <td>Add a new comment to card</td>
  </tr>
  <tr>
    <td>PUT</td>
    <td>/cards/{card_id}/comments/{comment_id}</td>
    <td>Update comment details by ID</td>
  </tr>
  <tr>
    <td>DELETE</td>
    <td>/cards/{card_id}/comments/{comment_id}</td>
    <td>Delete a comment by ID</td>
  </tr>
</table>