hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
181 stars 105 forks source link

[FEAT]: NewsLetter Page Api Endpoint - BACKEND #82

Closed Solomonuche closed 1 week ago

Solomonuche commented 1 month ago

Description

Develop a backend endpoint to handle requests for newsletter subscriptions. The endpoint will accept an email address, validate and sanitize it, and then handle both successful and failed validations appropriately. If the email passes validation, it will be stored in the database and a 'success' response will be sent to the client. If validation fails, an error message will be returned.

Acceptance Criteria

Requirements

Expected Outcome

Status code

Endpoint

[POST] /api/v1/pages/newsletter

Requests:

headers:

{
    "email": "string"
}

Responses:

Successful response

{
    "message": "string",
    "success": true,
    "status_code": int
}

Error response

{
    "message": "string",
    "success": false,
    "status_code": int
}

Database design

schema

Table name: subscribers_table

id:

email:

createdAt:

Testing

  1. Unit Tests

The systems should have unit tests covering:

markessien commented 1 month ago

No need for rate limiting

Solomonuche commented 1 month ago

Team Members working on this issue include:

I couldn't assign them directly to the repo since they don't have access to the repo

buka4rill commented 1 month ago

it's status_code not status code

Solomonuche commented 1 month ago

Thanks for the feedback. Changed status code to status_code