CS 347: Lab 16 – Follownet
Dear students:
Welcome to lab. Now’s your chance to apply the ideas you read about. Find a partner and complete as much of the task below as you can. At the end of our time together, paste your files into Crowdsource in order to receive credit.
Task 1
Create a database with two tables. The humans
table has a record for each user in the network. Each record in this table stores a human’s username, screen name, and a unique ID. The followers
table has a record for each human that follows another human. Each record in this table stores the ID of the follower and the ID of the followee.
Task 2
Create a web service that serves as an interface to the database. Add the following endpoints:
POST /humans
that accepts a JSON body containing a new human’s username and screen name. It returns a JSON structure reporting the ID assigned to the new human.GET /humans/:id
that returns as JSON an object with the human’s screen name and username.POST /follow/:followee/:follower
that adds a new following relationship to the database. It returns nothing but gives back status code 204, which means the operation silently succeeded.GET /follow/:followee
that returns as JSON an array of all of the followee’s followers.DELETE /follow/:followee/:follower
that adds a new following relationship to the database. It returns nothing but gives back status code 204, which means the operation silently succeeded.DELETE /humans/:id
that hard-deletes the human from the database, including any following relationships the human is involved in.
TODO
The next step of your learning is to complete the following tasks:
- Read the chapter Administering a Service in All Over the Web. Be sure to follow along with the code samples. Recreate each exercise yourself.
- Research some aspect of web development on your own. Find articles and videos beyond what’s assigned. Summarize what you learn in a couple paragraphs of your own words and a snippet of source code in your next blog entry before Friday morning. Clearly put the date of the blog entry on your index page. If any of the requirements is not met, you will not receive full credit.
See you next time.