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
.envfile in the root directory of the project and provide the following environment variables:[email protected] GMAIL_PASS=your-gmail-passwordReplace
[email protected]andyour-gmail-passwordwith 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.