GithubHelp home page GithubHelp logo

piccolo / flask-school-app-and-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mbithenzomo/flask-school-app-and-api

0.0 1.0 0.0 25.8 MB

Web app and REST API built with Flask

Home Page: https://flask-school-app.herokuapp.com/

Python 13.70% CSS 35.61% JavaScript 41.66% HTML 8.93% Mako 0.10%

flask-school-app-and-api's Introduction

Build Status Code Health

School App and API

This is a Flask app with an API layer. It has the following properties:

  1. It has the following relational entities:
    1. Student
    2. Teacher
    3. Subject
  2. Each student can have only one subject as a major, but can read any subject as well (minors)
  3. A subject is taught by one teacher
  4. It has endpoints to CREATE, UPDATE, and DELETE each entity in the application
  5. Only an authorized user can access the endpoints

Installation and Set Up

Clone the repo from GitHub:

git clone https://github.com/mbithenzomo/flask-student-api

Fetch from the develop branch:

git fetch origin develop

Navigate to the root folder:

cd flask-student-api

Install the required packages:

pip install -r requirements.txt

Create a .env file with the following keys:

SECRET_KEY
DATABASE_URI - for SQLAlchemy
TEST_DATABASE_URI - for SQLAlchemy
ENVIRONMENT - this is either production or development

Initialize, migrate, and upgrade the database:

python manage.py db init
python manage.py db migrate
python manage.py db upgrade

Launching the Program

Run python run.py. You may use Postman for Google Chrome to run the API.

API Endpoints

Resource URL Methods Description Requires Token
/api/v1 GET The index FALSE
/api/v1/auth/register POST User registration FALSE
/api/v1/auth/login POST User login FALSE
/api/v1/students GET, POST View all students, add a student TRUE
/api/v1/students/<string:id> GET, PUT, DELETE View, edit, and delete a single student TRUE
/api/v1/teachers GET, POST View all teachers, add a teacher TRUE
/api/v1/teachers/<string:id> GET, PUT, DELETE View, edit, and delete a single teacher TRUE
/api/v1/subjects GET, POST View all subjects, add a subject TRUE
/api/v1/subjects/<string:id> GET, PUT, DELETE View, edit, and delete a single subject TRUE

Sample API Requests

Registering and logging in to get a JWT token: User Registration

User Login

Displaying a paginated list of teachers: List of Teachers

Displaying a paginated list of subjects: List of Subjects

Updating a student: Updating Student

Web App

The app has a web-based interface and can be accessed here. A sample user has already been created with the following credentials:

username: testuser
password: testpassword

Login: User Login

Dashboard: App Dashboard

Displaying all students: Students

Displaying all teachers: Teachers

Displaying all subjects: Subjects

Testing

To test, run the following command: nose2

Built With...

Credits

Copyright (c) 2018 Mbithe Nzomo

flask-school-app-and-api's People

Contributors

mbithenzomo avatar dependabot[bot] avatar

Watchers

James Cloos 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.