Socially Inept Api is a mongoDB/mongoose Social Media api. It allows the creation of Users that can share thoughts, reactions, and become friends with other users. The User and Thought routes support Create, Read, Update, and Delete. Reactions and Friends are limited to Create and Delete, but can be Read through their parent Model (Users are the parent of Friends, and Thoughts are the parent of Reactions).
- Ensure that you have installed mongoDB on your local device.
- Clone repository
- Open a new command line that is in the correct directory
- Run
npm i
- The application can now be used.
Once the application has been installed, open a new command line within the repository's directory, enter the command npm start
. Socially Inept API is now up and running. You can now link it to your front end or manipulate the information with a program like Insomnia or PostMan which provides a UI to do a variety of GET, POST, PUT, DELETE requests.
Here is a detailed walkthrough in the usage of the Socially Inept API
Note that each of these routes are the subdirectory following your the domain that is hosting the database. Please insert your domain before the routes for proper usage. Additionally, many tables have validation if CONSTRAINED keys attempt to associate with an ID that doesn't exist it will throw an error.
- Route:
/api/users/
- Method: GET
- JSON: No JSON required
- Route:
/api/users/:id
- Method: GET
- JSON: No JSON required
- Route:
/api/users
- Method: POST
- JSON:
{
"username": "newUser",
"email": "test@email.com"
}
- Route:
/api/users/:id
- Method: PUT
- JSON:
{
"username": "editedUsername",
"email": "edited@email.com"
}
- Route:
/api/users/:id
- Method: DELETE
- JSON: No JSON required
- Note: This will cascade delete all associated thoughts and reactions
- Route:
/api/users/:userId/friends/:friendId
- Method: GET
- JSON: No JSON required
- Note: The
userId
is the_id
for the User that the friend is to be added to.friendId
is the_id
for the User that is being added.
- Route:
/api/users/:userId/friends/:friendId
- Method: DELETE
- JSON: No JSON required
- Note: The
userId
is the_id
for the User that the friend is to be removed from.friendId
is the_id
for the User that is being removed.
- Route:
/api/thoughts/
- Method: GET
- JSON: No JSON required
- Route:
/api/thoughts/:id
- Method: GET
- JSON: No JSON required
- Route:
/api/thoughts/
- Method: POST
- JSON:
{
"thoughtText": "Another Test Thought Here!",
"username": "{username for thought author}",
"userId": "{_id for the appropriate User that corresponds with the Username}"
}
- Route:
/api/thoughts/:id
- Method: PUT
- JSON:
{
"thoughtText": "{Edited thoughtText}"
}
- Route:
/api/thoughts/:thoughtId
- Method: DELETE
- JSON: No JSON required
- Route:
/api/thoughts/:thoughtId/reactions/
- Method: POST
- Note:
thoughtId
is the_id
for the Thought that the reaction correspondes with - JSON:
{
"reactionBody": "{reaction text goes here}",
"username": "{username of the reaction author}",
"userId": "{_id of the User that matches the username}"
}
- Route:
/api/thoughts/:thoughtId/reactions/:reactionId
- Method: DELETE
- Note:
thoughtId
is the_id
for the Thought that the reaction correspondes with, andreactionId
is thereactionId
of the reaction to be deleted (not to be confused with the reaction's_id
value) - JSON: No JSON required
MIT License
Copyright © 2021 Jake Pedigo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
A couple of tests were made to verify the Date Format Getters to standardize the date format within the Database. To initiate the test use the command: npm run test
Contributions to this project follow the Contributor Covenant additional information can be found here.
For any inquiries regarding Team Manager, please contact Jake Pedigo:
- GitHub: jbped
- Email: pedigojacob@gmail.com