blob: 5b4bd827b42ab3c01ff82b359c1723aeb6e4ee69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import generateOTP from '../utils/otp';
import sendMessage from '../services/twilio';
const sendOTP = async (req, res) => {
const {mobile} = req.body;
try {
const otp = generateOTP();
const message = `Your OTP for Aadhaar verification is : ${otp}`;
sendMessage(mobile, message);
res.status(200).json({message: 'OTP sent successfully', otpCode: otp});
} catch (error) {
res.status(404).json({message: error});
}
};
export default {sendOTP};
|