Skip to content

#2: Backend CRUD endpoints for Users table #39

Description

@AnanthKini1

Quote

"People will hear a fart, but no one reacts until it starts to smell. In life, nobody cares about the work you put in, only the results" - Lil drop top

Description

This PR implements backend CRUD endpoints for the users table, following the same pattern as projects.js.

Instructions

Task

  • Create server/routes/users.js
  • Implement:
    • GET /users — return all users
    • POST /users — create a new user (sign up), validate project_id exists
    • PUT /users/:id — update a user's info (ex: email, project_id)
    • DELETE /users/:id — remove a user
  • Use the right HTTP status codes for each endpoint
  • Test all four endpoints in Postman (seed users table if necessary), add images of successful tests for each endpoint to PR
  • Mount the new router in app.js under '/users'

Acceptance Criteria

  • users.js route file created
  • GET /users returns all users
  • POST /users creates a user and returns the new record
  • PUT /users/:id updates a user, returns right HTTP code if id doesn't exist
  • DELETE /users/:id removes a user, returns right HTTP code if id doesn't exist
  • All endpoints tested in Postman
  • Router mounted in app.js

Resources

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions