Skip to content

feat(Session 01-05) #61

Open
av-94 wants to merge 8 commits intogus-code:node/ana.vazquez.orihuelafrom
av-94:node/ana.vazquez.orihuela
Open

feat(Session 01-05) #61
av-94 wants to merge 8 commits intogus-code:node/ana.vazquez.orihuelafrom
av-94:node/ana.vazquez.orihuela

Conversation

@av-94
Copy link
Copy Markdown

@av-94 av-94 commented Sep 17, 2024

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

  1. MFEE - Node.js.postman_test_run Run All (Post & Categories).json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants