Coder Social home page Coder Social logo

hr's Introduction

Struct: Flask DataBase:Tencent Cloud SQL External API: https://poetrydb.org/author Supported by Github

DataBase: Poetry 3 tables: Users: administrator:admin, other users should be added by admin Roles: admin: add and delete users and common user's root user: can only add or update poetry to database Poetry:user can add queried poetry to database

Model.py def generate_auth_token(self): payload = { "id": self.id, "exp": int(time.time()) + current_app.config['TOKEN_TIME'], } token = jwt.encode(payload, current_app.config['SECRET_KEY'], algorithm='HS256') return token

hash encryption

Main Function:

def check_login(fun): check the users occur in database with token generated by jwt

@main.route('/api/login', methods=['POST']) def login(): users connect to our database

@main.route('/api/add/user', methods=['POST']) def add_user(user): admin can add new users to database

@main.route('/api/could_add', methods=['GET']) def could_add(): users can find authors who occur in poetry.com

@main.route('/api/add', methods=['POST']) def add(user): users can add queried poetry to database

@main.route('/api/delete', methods=['POST']) def delete(user): admin delete users from database

@main.route('/api/update', methods=['POST']) def update(user): Users can update their information in database or operated by admin

@main.route('/api/query/author', methods=['GET']) def query_author(): Users can query poetry by the author texted

@main.route('/api/query', methods=['GET']) def query(): Users get all information from poetry.com

hr's People

Contributors

tianyi5337 avatar

Watchers

 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.