Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename README.rst to README.md
- Loading branch information
Showing
2 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[WIP] Flask-sqla2api | ||
============== | ||
|
||
Flask middleware that creates a simple Flask API CRUD REST endpoint | ||
based on a SQLAlchemy model definition. | ||
|
||
#### Basic usage | ||
|
||
```python | ||
from flask import Flask | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_sqla2api import SQLA2api | ||
|
||
# Init app and DB | ||
app = Flask(__name__) | ||
db = SQLAlchemy(app) | ||
|
||
# Setup a simple SQLAlchemy model | ||
class Entry(db.Model): | ||
id = db.Column(db.Integer, primary_key=True) | ||
name = db.Column(db.String(80)) | ||
|
||
# Init Flask-sqla2api and register its blueprint | ||
api = SQLA2api(app, Entry, db) | ||
app.register_blueprint(api.make_blueprint(), url_prefix='/') | ||
``` | ||
The previous tiny app will create the following endpoints | ||
|
||
| URL | HTTP Method | Action | | ||
|---------------|-------------|-----------------------| | ||
| `/entry` | GET | Get all entries | | ||
| `/entry` | POST | Create new entry | | ||
| `/entry/<id>` | GET | Get a single entry | | ||
| `/entry/<id>` | PUT | Edit existing entry | | ||
| `/entry/<id>` | DELETE | Delete existing entry | | ||
|
||
### TODO | ||
|
||
* [x] Add PUT/GET/DELETE for single entry | ||
* [ ] Add documentation | ||
* [ ] Add various CI files (`.travis.yml`, `tox.ini`) | ||
* [ ] Add `setup.py` | ||
* [ ] Separate requirements for dev environments |
This file was deleted.
Oops, something went wrong.