MongoDB is a popular choice for making databases for its ability to handle large amounts of data and flexibility with unstructured data. The following application is a social network web app where users can share their thoughts, react to friends’ thoughts and create a friend list. Using Express.js for routes, MongoDB for the database and Mongoose ODM. To test the database, the application Insomnia was used to look at the functionality and seeding the data.
- Javascript ES6+
- Node.js
- Express.js
- MongoDB & Mongoose ODM
- Insomnia
Below is an example of how you can download the project onto your own device:
- Clone the repository using this link:
git clone https://github.com/squrpe/social-network-api.git
You will need to download the suitable extensions to run the application in the command line.
- Install the node modules needed for the project within the terminal
npm install
- To start the server, use the node command
npm start
.
Below is an example of the program in Insomnia when seeded:
You can also access the example video by clicking here
If done correctly, MongoDB Compass will reflect the same information:
Using Insomnia, the following routes were used to test and seed the functionality behind the application. The above video demonstrates how to seed each route.
User
- Find All Users:
GET
/api/users
- Find Single User by Id:
GET
/api/users/:userId
- Create User:
POST
/api/users
- Update User by Id:
PUT
/api/users/:userId
- Delete User by Id:
DELETE
/api/users/:userId
Friend
- Add Friend:
POST
/api/users/:userId/friends/:friendId
- Remove Friend:
DELETE
/api/users/:userId/friends/:friendId
Thought
- Find All Thoughts:
GET
/api/thoughts
- Find Single Thought by Id:
GET
/api/thoughts/:thoughtId
- Create Thought:
POST
/api/thoughts
- Update Thought by Id:
PUT
/api/thoughts/:thoughtId
- Delete Thought by Id:
DELETE
/api/thoughts/:thoughtId
Reaction
- Create Reaction by Id:
POST
/api/thoughts/:thoughtId/reactions/:reactionId
- Delete Reaction by Id:
DELETE
/api/thoughts/:thoughtId/reactions/:reactionId
Project Idea: The University of Adelaide Coding Bootcamp
Lara Nicole - grockelara@gmail.com
Project Link - https://github.com/squrpe/social-network-api
Distributed under the MIT License. See LICENSE.txt for more information.