Skip to content

Commit

Permalink
Update and rename README.rst to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
acifani committed Sep 25, 2017
1 parent 9f8a5a2 commit ffe0bae
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
43 changes: 43 additions & 0 deletions README.md
@@ -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
13 changes: 0 additions & 13 deletions README.rst

This file was deleted.

0 comments on commit ffe0bae

Please sign in to comment.