Giter Site home page Giter Site logo

jawadahmadd / flask-mongo-api-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukepeters/flask-mongo-api-boilerplate

0.0 0.0 0.0 41 KB

A simple Flask/MongoDB API boilerplate with user account creation, token-based authentication, and login-protected routes.

Python 55.68% Shell 14.77% CSS 7.79% JavaScript 9.65% HTML 12.12%

flask-mongo-api-boilerplate's Introduction

Requirements

  • MongoDB
  • Python 3 (defaults to Python 3.7, but you can change this in the Pipfile before setup)

Setup instructions

  1. Clone this repo to your local web server
  2. cd into the directory within the terminal
  3. Run ./setup to setup pipenv and configure the Flask app

Here's a quick video of the setup process (no audio): flask-mongo-api-boilerplate-setup.mp4

Running the app

  1. Run pipenv shell to activate the virtual environment
  2. Run ./run to start the Flask application

Further configuration

You can configure the app manually by editing the api/main/config/config.cfg file.

Auth tokens

There is a very basic front-end example in place within the /web directory. It demonstrates making a few API calls (User Add and User Login).

A successful login request will return two tokens: AccessToken and RefreshToken. These should be saved to localStorage and used to set the AccessToken and RefreshToken request headers for all protected routes (e.g. GET /user/).

You can refresh the AccessToken when it returns as expired by submitting a request to GET /user/auth/.

Notes

Please excuse the brief instructions. I've only run this in my own environment (MacOS, Python 3.7, MongoDB 4.0.4, pipenv 2018.11.14) so it may not run out of the box on your computer, but I'd be happy to help debug if you get stuck. Reach out to me on Twitter: @MoonlightLuke

flask-mongo-api-boilerplate's People

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.