This is an API for a social network web application where users can share their thoughts, react to friends' thoughts, and create a friends list. It uses Express for routing, MongoDB database, Mongoose ODM, and Javascript Date object to format a timestamp. The seed data was created using Insomnia.
Click on the image below to reveal the video walk-through of the installation & users-route
process:
Click on the image below to reveal the video walk-through of the friend-route, thoughts-route, & reaction-route
process:
-
First, clone the git repository from GitHub
- Open the clone file in VS code or in your terminal
- Create your
.gitignore
and.env
files. - Check the
dependencies
anddev-dependencies
that are needed onpackage.json
.
-
Next, set up all the existing npm packages, run
npm init
. -
Then, install the required dependencies on the
node_modules
folder, run:npm install
. -
Then, make sure
MongoDB
is installed on your computer.- To invoke the application, run:
npm start
. The Mongoose models are synched to the MongoDB database when the server starts. - Connect to the MongoDB URI
mongodb://localhost:27017
. Selectsocial-network-api
to seethoughts
andusers
data.
- To invoke the application, run:
-
To create seed data and test the API routes, use
Insomnia
orPostman
(view Test section).
Utilizing this API enables users to establish a new user profile using a valid username and email. Additionally, users can connect with other individuals, share their own "thoughts," respond with "reactions" to thoughts, update and delete both thoughts and reactions, and remove connections with friends.
-
First, make sure to install the given application following the previous steps and video walkthrough.
-
Next, this app uses MongoDB and a NoSQL database, that allows the website to handle large amounts of data.
- Navigate to NoSQL app like MongoDB Compass, make sure you are connected to the the URI:
mongodb://localhost:27017
- The
social-network-app
will be available to view and edit
- Navigate to NoSQL app like MongoDB Compass, make sure you are connected to the the URI:
-
Then, using
Insomnia
orPostman
, test the application's CRUD commands:- Using the API GET routes for Users, Friends, or Thoughts, the data for each of these routes will be displayed.
- When the user clicks the
GET
request forALL
Users or Thoughts, then they are presented with all the data according to each route. - When the user clicks the
GET
request for aSINGLE
User or Thought id, then they are presented with data for the appropriate ID of each route folder. - When the user tests the
POST
,PUT
, orDELETE
API routes for Users, Friends, or Thoughts, then they are able tocreate
,update
, ordelete
data using the corresponding:_id
within each route folder.
-
Begin by cloning the Repo from the GitHub page, then create a new branch to test the application.
-
Run the following
CRUD
commands in Insomnia or Postman for each category:-
USER
- Get all users:
GET /api/users
- Create a user:
POST /api/users
- Get user by ID:
GET /api/users/:userId
- Update a user:
PUT /api/users/:userId
- Delete a user:
DELETE /api/users/:userId
- Add a friend:
PUT /api/users/:userId/friends/:friendId
- Delete a friend:
DELETE /api/users/:userId/friends/:friendId
- Get all users:
-
THOUGHT
- Get all thoughts:
GET /api/thoughts
- Create a thought:
POST /api/thoughts
- Get thought by ID:
GET /api/thoughts/:thoughtId
- Update a thought:
PUT /api/thoughts/:thoughtId
- Delete a thought:
DELETE /api/thoughts/:thoughtId
- Get all thoughts:
-
REACTION
- Add a reaction:
PUT /api/thoughts/:id/reactions
- Delete a reaction:
DELETE /api/thoughts/:id/reactions
- Add a reaction:
-
This project is covered under the following license:
If you have any questions, please email me at: knickler3@gmail.com
My GitHub page is: kwaters3