Skip to content

Implement Create Todo endpoint (POST /todos) #4

@landoyjx

Description

@landoyjx

Implement POST /todos to create a new Todo item. Request body must contain title (string, non-empty). Response should be 201 Created with the full Todo object.

Acceptance Criteria:

  • Returns 201 and the created Todo on success
  • Returns 400 if title is missing, null, or empty string
  • createdAt and updatedAt are set automatically

Test Cases:

  • Integration: POST /todos with { "title": "Buy milk" } returns 201 and a Todo object with id, title, completed=false, createdAt, updatedAt
  • Integration: POST /todos with { "title": "" } returns 400 with JSON error
  • Integration: POST /todos with {} returns 400 with JSON error
  • Edge: POST /todos with extra fields ignores them and still creates the Todo

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions