🔍 This is an API for a social network application where users can share their thoughts/comments, add to a friends list, remove friend(s), and react to friends thoughts. It uses Express.js for routing, a MongoDB database, the Mongoose ODM, and moment.js to format timestamps. The seed data is created using Insomnia. To see how the API works using Insomnia, the below link is the walk-through demonstration videos: https://drive.google.com/file/d/1DhH9WTA51WXPyug_9IyxcF9DA6l_bER0/view?usp=share_link
social-1.mp4
On the left side below screenshot, you can see the GET POST PUT DELETE routes for Users, Thoughts, Friends, Reactions.
- Clone the repository to use the application on a local machine
- Node.js and MongoDB is required to run the application.
- To install necessary dependencies, run the following command:
npm i
💻
- After following the installation instructions, run
npm start
to start the server. - When the server is started, the MongoDb models are synched to the MongoDB database.
- Open MongoDB and connect to the MongoDB URI
mongodb://localhost:27017
. On the list of databases, click onsocialDB
to seeuser
andthoughts
data. - Go to Insomnia through localhost to create seed data and test the API routes, also see the tests section below.
👥 Xiaojing Deng
Permission to use this application is granted under the MIT license.
Insomnia is used to test API calls. Please see the walk-through demonstration video:
https://drive.google.com/file/d/1DhH9WTA51WXPyug_9IyxcF9DA6l_bER0/view?usp=share_link.
On Insomnia, the following API routes have been created:
USER
-
Create a new user:
POST /api/users
-
Get all users:
GET /api/users
-
Get a single user by
id
:GET /api/users/:userId
-
Update a user by
id
:PUT /api/users/:userId
-
Delete a user by
id
:DELETE /api/user/:userId
FRIEND
- Add a new friend to a user's friend list:
POST /api/users/:userid/friends/:friendId
- Delete a friend from a user's friend list:
DELETE /api/users/:userid/friends/:friendId
THOUGHT
- Create a new thought:
POST /api/thoughts/
- Get all thoughts:
GET /api/thoughts/
- Get a single thought by
id
:GET /api/thoughts/:thoughtId
- Update a thought by
id
:PUT /api/thoughts/:thoughtId
- Delete a thought by
id
:DELETE /api/thoughts/:thoughtId
REACTION
- Create a reaction:
POST /api/thoughts/:thoughtId/reactions
- Delete a reaction by the
reactionId
:DEL /api/thoughts/:thoughtId/reactions/:reactionId
✋Reach me here:
Find me on GitHub: xiaojing168jmg168
📩 Email me with any questions: 8redfishcreative@gmail.com