Giter Site home page Giter Site logo

flask-todo-app's Introduction

Simple Todo App with Flask

This repo demonstrates simple Todo App in Flask with following components:

  • Flask SqlAlchemy
  • Flask Migrate
  • Flask Restful
  • Flask Jwt Extended

Installation

git clone https://github.com/aydin/flask-todo-app
cd flask-todo-app
pip install -r requirements.txt
export FLASK_APP=todo.py

Run the following commands to create your app's database tables and perform the initial migration

flask db init
flask db migrate
flask db upgrade

To run the web application:

flask run

How run the tests?

tox

Deployment

docker-compose up

Request Examples

  • Register
curl -X POST \
  http://127.0.0.1:5000/registration \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{"username":"john","password":"johndoe"}'

Get acess_token from response and use it for next requests in Authorization header.

  • Create Todo item
curl -X POST \
  http://127.0.0.1:5000/todos \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{"name":"todo item 1", "due_date": "2019-02-20"}'
  • List Todo items
curl -X GET \
  http://127.0.0.1:5000/todos \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json; charset=utf-8'
  • Update Todo item
curl -X PUT \
  http://127.0.0.1:5000/todos/1 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{"name": "updated todo item"}'
  • Delete Todo item
curl -X DELETE \
  http://127.0.0.1:5000/todos/2 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json; charset=utf-8'
  • Revoke access token
curl -X POST \
  http://127.0.0.1:5000/logout/access \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer your_access_token' \
  -H 'Content-Type: application/json; charset=utf-8'
  • Revoke refresh token
curl -X POST \
  http://127.0.0.1:5000/logout/refresh \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer your_refresh_token' \
  -H 'Content-Type: application/json; charset=utf-8'

flask-todo-app's People

Contributors

aydin avatar

Watchers

James Cloos avatar Kaan Ant avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.