Routes

Newsletter

Overview

This code defines routes related to newsletters in a Laravel application. It includes a GET route for health checks (newsletters/_ping) and a POST route (newsletters/signup) that allows users to sign up for newsletters using the create method from NewsletterController. The routes are organized under a newsletters prefix, promoting clean and maintainable code.


Sign Up for Newsletter

  • Route: POST ../newsletters/signup
  • Controller: NewsletterController
  • Method: create
  • Request: NewsletterSignupRequest
  • Description: Endpoint to sign up for the newsletter.

The create method in the NewsletterController handles the newsletter signup request. It validates the incoming request using the NewsletterSignupRequest class. After validation, it logs the signup using the newsletterService with the provided email address and IP address.

The method then returns a 201 Created response with the details of the newly created newsletter log, formatted using the NewsletterResource.

Request Parameters for :

  • Header :- Accept-Language:- en-UK,en
  • Body :
  • email_address: Customer’s email (email, required).
  • ip: 192.168.50.137

Response:-

Status: 201 Created

  
 "data": {
      "email_address": "shivang-g001@webreinvent.com",
      "ip": "192.168.50.137"
  }
  

Copyright © 2026