Backend,RESTful API
Demo URLS
https://factbook-explorers-two.herokuapp.com/population-levels
https://factbook-explorers-two.herokuapp.com/gross-gdp
To get started download the repo using SSH (guide on SSH)
git clone git@github.com:mannuelf/nuc-studio-1-project-backend.git
cd nuc-studio-1-project-backend/
Install packages easily with a package manager.
pyenv manages your python versions on your laptop. so you can install multiple versions, MacOS ships with 2.7 but we need >= 3.8.7
If all required dependencies are installed, to work on the project you must run it in a python environment using pipenv.
Install pyenv first: installation instructions
pyenv global 3.8.7
The run this command in your shell to init pyenv.
eval "$(pyenv init -)"
Also add is to your .bash_profile. what is bash_profile? click here to read.
pip install pipenv
There is a Pipfile, which lists all packages needed to run app.
pipenv install
Run this command to start a python environment, immediately afterwards run python app.py, this will start the server and you can begin.
pipenv shell
Start in DEVELOPMENT mode
export FLASK_ENV=development
then run the app
flask run
Method | Endpoint | Description |
---|---|---|
GET | /population-levels | Gets all population level |
GET | /population-levels/country | Gets all population level by country |
GET | /population-levels/country/year | Gets all population level by country and year |
GET | /hello-world | Gets all test messages |
GET | /hello-world/{id} | Get one message |
POST | /hello-world/ | Post a message to API |
You should use pyenv to install latest version of python
https://github.com/pyenv/pyenv, use the automatic installer: https://github.com/pyenv/pyenv-installer
pip3 install pyenv
pipenv shell
pipenv install flask flask-sqlalchemy flask-marshmallow marshmallow-sqlalchemy
You are good to go, start building, now you can run the app inside of pipenv.
Run server in development mode.
export FLASK_ENV=development
Start development server.
flask run
In the console you should see:
Navigate to: http://localhost:5000/hello-world
$ python app.py
>> from app import db
>> db.create_all()
>> exit()
We will use peer review in the form of Pull Requests. You must make a feature branch before starting to code. The main
branch must always be clean and deployable at all times, do not work on main
branch.
Lessons on branches and merging can be seen here: 📺 Watch
We are using Github Issue and Project board to manage tasks.
https://github.com/mannuelf/nuc-studio-1-project-backend/issues
https://github.com/mannuelf/nuc-studio-1-project-backend/projects/1
Create and issue using the issus board.
- keep
main
branch clean and deployable at all times, do not code on it. - Fork Repo or
- if already on the team create a feature branch
- Work on your task
- Create a Pull Request.