Skip to content

patelaryan0914/OTPwizard-BackendTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


OTPWizard Backend

This is a backend application designed to test the functionality of the otpwizard npm package. The backend provides endpoints for sending OTP emails and verifying OTPs.

Installation

  1. Clone the repository:

    git clone <repository_url>
  2. Install dependencies:

    cd OTPWizard-Backend
    npm install
  3. Set up environment variables:

    Create a .env file in the root directory of the project and provide the following environment variables:

    [email protected]
    GMAIL_PASS=your-gmail-password
    

    Replace [email protected] and your-gmail-password with your actual Gmail credentials.

  4. Start the server:

    npm start

Usage

Endpoints

  • POST /sendMail:

    • Description: Generates an OTP of specified length and sends it via email to the provided email address.
    • Request Body:
      {
        "Otplength": 6,
        "emailInput": "[email protected]"
      }
    • Response:
      {
        "msg": "Otp Send",
        "otp": "123456"
      }
  • POST /verifyOtp:

    • Description: Verifies whether the provided OTP matches the expected OTP.
    • Request Body:
      {
        "otpInput": "123456",
        "otp": "123456"
      }
    • Response:
      {
        "msg": "checked",
        "isValid": true
      }
  • GET /check:

    • Description: Checks if the server is running.
    • Response:
      {
        "msg": "all ohk"
      }

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published