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.
-
Clone the repository:
git clone <repository_url>
-
Install dependencies:
cd OTPWizard-Backend npm install
-
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]
andyour-gmail-password
with your actual Gmail credentials. -
Start the server:
npm start
-
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" }
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
This project is licensed under the MIT License.