cd
into the directory it createsdatabase.json
file in the api
directory.ignore
file in the api
directoryNote: Your
database.json
file is already in the.gitignore
file for this project, so it will never be added to the repo or pushed to Github.
Nutshell is a new product offering that you have been tasked with building. It's a dashboard for people to use to organize their daily tasks, events, news article, friends, and chat messages.
You will be utilizing all of the skills and concepts that you've learned up to this point in the course.
To start you off, here's an example of what the resources in your API should look like once it's populated with some data from your application.
{ "id": 1, "username": "Steve", "email": "me@me.com", "password": "xxxxxxxxxxxxxxxxxxxxx" }
{ "id": 1, "userId": 1, "message": "What's up?" }
{
"id": 1,
"userId": 2,
"url": "https://www.quantamagazine.org/newfound-wormhole-allows-information-to-escape-black-holes-20171023/",
"title": "Wormholes Allow Information to Escape Black Holes",
"synopsis": "Check out this recent discovery about workholes"
}
{ "id": 1, "userId": 1, "following": 3 }
{ "id": 1, "userId": 3, "task": "Take out garbage", "complete": false }
Be very clear that what you will be implemeting is not real authentication. It is a simulation of it using very simplistic tools.
You will be using session storage to keep track of which user has logged into Nutshell. When the user fills out the registration form, you will POST their email, username and password to the users
collection in your API. You will then immediately take the id
of the object in the response and save it to session storage.
sessionStorage.setItem("activeUser", user.id)
If you want to add a Logout feature, all you need to do it remove the session storage item.
sessionStorage.removeItem("activeUser")