0.0.0 • Published 8 years ago

generator-flask-api-generator v0.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

generator-flask-api-generator

NPM version Build Status Dependency Status

Generates controllers, models, validators, and api scaffold for flask python

Installation

First, install Yeoman and generator-flask-api-generator using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-flask-api-generator

Then generate your new api endpoint:

yo flask-api-generator COMMAND FOLDER MODEL TABLE FIELDS

Example

yo flask-api-generator api . User users 'id:integer,primary,increment|username:string=80,notnull'

This generates model, controller and validator for User

"." - represents the current folder as the FOLDER

License

MIT © Michael Brucal for Wingaru Kids

Commands

api - generates the controllers, models and validators

model - generates a model

validator - generates a validator

controller - generates a controller on FOLDER/controllers/MODEL_NAME

Model Fields

FieldsDescription
stringcreates a db.String
intcreates a db.Integer
textcreates a db.Text
boolcreates a db.Boolean
floatcreates a db.Float
datecreates a db.DateTime
primarycreates a primary_key=True
uniquecreates a unique=True
indexcreates an index=True
nullcreates a nullable=True
notnullcreates a nullable=False
incrementcreates a db.Sequence('VALUE')
foreigncreates a db.ForeignKey('VALUE')
relationshipcreates a db.relationship('VALUE')
defaultcreates a server_default

Validator Fields

Fields
min
max
length
equals
anyof
range
required
email
url
trim