Skip to content

EvertonAlauk/flask-restplus-users

Repository files navigation

API REST com Flask, Flask-Restful, SQLAlchemy e PostgreSQL

Necessário ter o virtualenv, pip e o postgres instalados!

  1. Instale todas as dependências:
$ pip install -r requirements.txt
  1. Crie a tabela:
$ ./models.py
  1. Execute a aplicação:
$ FLASK_APP=app.py flask run
  1. Execute os comandos:
>> import requests, json
>> data_post = { 'first_name': 'User', 'email': 'user@gmail.com' }
>> data_put = { 'first_name': 'User', 'email': 'usertest@gmail.com' }
>> headers = { 'Content-Type': 'application/json' }
>> id = 1

>> requests.post('http://localhost:5000/users/', headers=headers, data=json.dumps(data_post)).json()
>> requests.get('http://localhost:5000/users/').json()
>> requests.put('http://localhost:5000/users/{}'.format(id), headers=headers, data=json.dumps(data_put)).json()
>> requests.delete('http://localhost:5000/users/{}'.format(id))

About

API REST com o framework Flask do Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages