This project provides the HTTP API with endpoints for the mobile app
Backend-api provides endpoints to request random proposals, authors and news.
Our docker-compose descriptor takes care of everything providing mongodb intance and backend-api HTTP interface. Make sure you have installed docker and docker-compose.
$ docker-compose up
Test if the HTTP interface is up and running:
$ curl http://localhost:8000/
{"hello": "meuParlamento.pt"}
Once you have mongodb up and running you can import the data available at https://github.com/meuparlamento/open-data.
$ git clone https://github.com/meuparlamento/open-data
$ mongoimport --db meuParlamento --collection proposals --file open-data/proposals.json
In case you prefer not to use Docker we recommend creating a python environment and installing all python requirements:
pip install -r requirements.txt
This project is based on a microframework called Chalice, a Python Serverless Microframework for AWS. Chalice allows you to quickly create and deploy applications that use Amazon Lambda. For more information on how to setup and deploy this project to Amazon AWS please check Chalice Documentation.
In order to run it locally just type:
chalice local --port 9000 --stage manual
Our docker description takes care of mongodb instance and url. If you need to customize it,
edit .chalice/config.json. To illustrate it, if you have a local mongodb instance please edit MONGODB_URI
value (e.g. mongodb://localhost:27017
).
{
"version": "2.0",
"app_name": "meuparlamento-backend-api",
"stages": {
"manual": {
"api_gateway_stage": "manual",
"environment_variables": {
"MONGODB_URI": "mongodb://localhost:27017",
"DB_NAME":"meuParlamento"
}
}
}
}
To run tests you can use pytest:
pytest
Team meuParlamento.pt [email protected]
Distributed under the GPL license. See LICENSE
for more information.
https://github.com/meuparlamento
- Fork it (https://github.com/meuparlamento/meuparlamento-backend-api/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request