A REST API framework for building CRUD APIs using Sanic and peewee


Keywords
sanic, api, rest, crud
License
MIT
Install
pip install sanic-crud==0.2.4

Documentation

sanic_crud

Build Status PyPI PyPI version

sanic_crud is a REST API framework for creating a CRUD (Create/Retrieve/Update/Delete) API using Sanic and PeeWee You can use sanic_crud to automatically create an API from your PeeWee models, see how it works in the Documentation Contributions to the repository are welcome!

Example

from peewee import CharField, DateTimeField, SqliteDatabase, Model
import datetime
from sanic import Sanic
from sanic_crud import generate_crud

db = SqliteDatabase('my_app.db')

class BaseModel(Model):
    class Meta:
        database = db

class Person(BaseModel):
    name = CharField()
    email = CharField()
    create_datetime = DateTimeField(default=datetime.datetime.now, null=True)

db.create_tables([Person])

app = Sanic(__name__)
generate_crud(app, [Person])
app.run(host="0.0.0.0", port=8000, debug=True)

Installation

  • python -m pip install sanic-crud

Documentation

Documentation can be found in the docs directory.

TODO