This is a back-end application providing APIs for a social network web application where users can share their thoughts, react to friends' thoughts, and create a friend list.
Please watch this video https://www.youtube.com/watch?v=RAhfnYqq0Yw for the demo of the application.
-
Install MongoDB in your local machine, please refer to MongoDB documentation for installation procedures.
-
Start with cloning this repo:
$ git clone https://github.com/heidiwu3388/Social-Network-API.git
-
Install all dependencies
$ cd Social-Network-API $ npm install
-
Seed the database (optional)
$ npm run seed
-
run the application
$ npm start
- While the server is running, it is ready for any REST client to make the API calls.
- The front end is not included in this project, but the APIs can be called by using a REST client of your choice (such as Insomnia and Postman).
- The following endpoints are provided:
-
Users
-
GET All Users
-
GET Single User by Id
-
CREATE User
- POST http://localhost:3001/api/users/
- the request body should look like this:
{ "username": "lernantino", "email": "[email protected]" }
-
UPDATE User
-
DELETE User and delete the associated thoughts
-
-
Friends
-
Add Friend (add friendId to user's friend list)
-
Remove Friend (remove friendId form user's friend list)
-
-
Thoughts
-
GET All Thoughts
-
GET Thought by Id
-
CREATE Thought and add thought id to user's thought list
- POST http://localhost:3001/api/thoughts
- the request body should look like this:
{ "thoughtText": "Here's a cool thought...", "username": "lernantino", "userId": "5edff358a0fcb779aa7b118b" }
-
UPDATE Thought
-
DELETE Thought
-
-
Reactions
- Add Reaction
- Remove Reaction
-
- Server:
- Node.js
- Express.js
- Database:
- MongoDB
- Mongoose