Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.
/ JFlask Public archive

❄️ JFlask: Template for Flask RESTful API and management

Notifications You must be signed in to change notification settings

junhoyeo/JFlask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JFlask

logo

❄️ JFlask: Template for Flask RESTful API and management

Server

RESTful API server with a systematic structure separated by resources for rapid development

  • flask-common: common settings
  • flask-cors: CORS 설정
  • flask-jwt-extended: JWT 관리(Bearer)
  • flask-restplus: REST API 구축과 Swagger 문서화
  • flask-pymongo: MongoDB 데이터베이스 연동
  • validators: 데이터 검증
  • gevent: react asynchronous

Structure

namespaces
├── test
│   ├── __init__.py
│   ├── models.py
│   └── resources
│       └── test.py
└── __init__.py
  • server.namespaces 아래에는 API의 각 Namespace(네임스페이스)에 대한 모듈이 위치합니다.
  • 하위 네임스페이스에서 리소스를 추가하기 위해서 extend_namespaceNamespace를 확장한 뒤 add_resources 메소드를 사용합니다.
    • resourcesResource(리소스)에 대한 각각의 모듈을 가집니다.
    • models는 해당 네임스페이스의 리소스에서 사용하는 Namespace.model들을 가집니다.
  • extend_namespace 확장에 존재하는 validate 메소드는 validator에 따라 ns.payload의 필드를 검증합니다(실패 시 400).

Documentation

server

server.create_app()

Create Flask app and returns _app

server.mongo

Initialized PyMongo(from flask-pymongo)

server.common

Initialized Common(from flask-common) with app

server.namespaces

server.namespaces.extend_namespace

server.namespaces.hash_password

server.namespaces.api

App for management

Admin app with Vue.js