This project contains two RESTful back-end microservices. Our microvlogging API offers services similar to twitter.
- Alfonso Figueroa - [email protected]
- Ryan Luong - [email protected]
- Added two new services to timeline and user
- to test new changes: $ http GET localhost:5000/home/Alfonso
- Python
- Bottle Framework
- SQLite3
- MySQL
- Foreman
- HTTPie
- Authentication
- Foreman, httpie, sqlite3
$ sudo apt install --yes python3-pip ruby-foreman httpie sqlite3
- Bottle and SQLite plugin for bottle
$ python3 -m pip install bottle bottle-sqlite
- git clone
https://github.com/alfonsf1/microBlogging.git
- To create the database
- Launch the terminal and type
cd microBlogging
$ sqlite3 timeline.db
sqlite> .read timeline.sql
sqlite> .exit
$ sqlite3 user.db
sqlite> .read user.sql
sqlite> .exit
- Launch the terminal and type
- To start the database
- In the terminal type:
$ foreman start -m gateway=1,users=1,timelines=3
- In the terminal type:
- Open a new terminal in the same directory and use the methods listed below;
localhost:5000 is connected gateway.py
localhost:5100 is connected to user.py
localhost:5200 is connected timeline.py
-
Crate User
- createUser function crates a user that is tied to a username, password, and an email
- Example
$ http post localhost:5100/user username="Sergio" password="xyz789A12" email="[email protected]"
- Example
- createUser function crates a user that is tied to a username, password, and an email
-
Check Password
- checkPassword functon takes in the parameters of a username and password and check it with the data base.
- Exanple
$ http get localhost:5100/user/Alfonso/adwO12312
- Exanple
- checkPassword functon takes in the parameters of a username and password and check it with the data base.
-
Add Follower
- addFollower function takes in the parameter of the username account and the name of the user they wish to follow.
- Example
$ http post localhost:5100/user/follower/add username="Alfonso" follower="Rosendo"
- Example
- addFollower function takes in the parameter of the username account and the name of the user they wish to follow.
-
Remove Follower
- removeFollower function takes in the parameter of the username account and the name of the user they want to unfollow
- Example
$ http DELETE localhost:5100/user/follower/remove username="Alfonso" follower="Rosendo"
- Example
- removeFollower function takes in the parameter of the username account and the name of the user they want to unfollow
-
User Timeline
- userTimeline gets all of the posts of the signed in user
- Example
$ http GET localhost:5200/timeline/Alfonso
- Example
- userTimeline gets all of the posts of the signed in user
-
Public Timeline
- publicTimeline displays of the users posts from the micro blogging service
- Example
$ http GET localhost:5200/timeline/public
- Example
- publicTimeline displays of the users posts from the micro blogging service
-
Home Timeline
- homeTimeLine displays the post of the followers of the user
- Example
$ http GET localhost:5200/timeline/home/Alfonso
- Example
- homeTimeLine displays the post of the followers of the user
-
Post Tweet
- postTweet function allows users to post to the timeline
- Example
$ http post localhost:5200/timeline/create author="Alfonso" text="Hello! Today is Monday"
- Example
- postTweet function allows users to post to the timeline
-
Gateway Function
- Uses gateway function to communicate with user and timline service to retieve timiles for the specified user
- Example
$ http GET localhost:5000/home/Alfonso
- Example
- Uses gateway function to communicate with user and timline service to retieve timiles for the specified user