MyDiary is an online journal where users can pen down their thoughts and feelings.
Documentation: https://mydiaryrestapi.docs.apiary.io/
Heroku Link: https://online-diary-v1.herokuapp.com/
Functionality | Method | Endpoint |
---|---|---|
Get all entries | GET | /mydiary/v1/entries |
Get specific entry | GET | /mydiary/v1/entries/id |
Add an entry | POST | /mydiary/v1/entries |
Modify an entry | PUT | /mydiary/v1/entries/id |
Delete an entry | DELET | /mydiary/v1/entries/id |
Register | POST | /mydiary/v1/auth/register |
Login | POST | /mydiary/v1/auth/login |
- Python3 (programming language)
- Flask (Python webframework)
- Virtualenv(To isolate Api modules)
- Pytest (Tool for testing)
- Postgresql (Database used)
To set it up in your machine:
1.sudo install python3
2.pip install virtualenv
git clone https://github.com/charisschomba/Diary.git
cd Diary/
virtualenv [name of virtualenv]
source [name of virtualenv]/bin/activate
pip install -r requirements.txt to install the modules
sudo -i -u postgres
or su postgres
create database
createdb database_name
create user
psql -c "CREATE USER db_user WITH PASSWORD 'password' createdb" -U postgres
run
python create_database.py
to create the two tables required
export FLASK_APP="run.py"
export FLASK_ENV="development"
export JWT_SECRET_KEY="anyrandomlongstring"
export DB_HOST="localhost"
export DB_NAME="database_name"
export DB_USERNAME="db_user"
export DB_PASSWORD="password"
export SECRET_KEY="any randomlongstring"
flask run
use the above specified endpoints in the table for testing.
cd to Diary/challenge3 folder
pytest
pylint
for code rating.