feat(Session 01-05) #61
Open
av-94 wants to merge 8 commits intogus-code:node/ana.vazquez.orihuelafrom
Open
Conversation
gus-code
reviewed
Sep 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All the test passed - MFEE-NodeJs - Run Results here 1.
Session 01
Create route for posts endpoint with the following methods:
GET /posts Return an array of all the posts with status code 200
GET /posts/category/:category Return an array of all the posts by category with status code 200
GET /posts/:id Return a post by id with category object and each comment object in the array with status code 200
POST /posts Create a new post and return the created post with status code 201
POST /posts/:id/comments Create a comment inside the post and return the comment with status code 201
PATCH /posts/:id Update post information and return the updated post with status code 200
DELETE /posts/:id Delete the post and return the deleted post with status code 200 or 204 if you decide to not return anything
Add 404 validation where needed
Post model
id: string
title: string
image: string
description: string
category: string Id of the category
comments: array Array of comment ids
Comment model
id: string
author: string
content: string
Session 02
Refactor the code from last session to add a post controller
Session 03
N/A
Session 04
N/A
Session 05
Create MongoDB database
Connect to MongoDB database using mongoose
Create models for Post and Comment
Refactor the controller to retrieve information from database
Tip: Use populate method to get data from reference id
Extra
Remove post comments from database when you delete the post
Note
I don't have the option to add a reviewers, and I'm not sure who else need to verify this PR
@gus-code
Footnotes
MFEE - Node.js.postman_test_run Run All (Post & Categories).json ↩