hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
153 stars 141 forks source link

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

Open Solomonuche opened 1 month 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:

Solomonuche commented 1 month ago

This Issue Links To The Approved Issue Here