-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (21 loc) · 983 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const express = require('express');
const app = express();
const port = process.env.PORT || 5000;
app.get('/', (req, res) => {
res.send("server is started but you have to go to (/send_sms) route for send otp thanks ");
})
app.get('/send_sms', (req, res) => {
res.send(`your OTP has been sent to given phone Number ${req.query.phone_number} with otp : ${req.query.otp}`);
const fast2sms = require('fast-two-sms')
var options = {authorization : "x4Zp3IUA7OliNTcGunMWqfs5X1m0QhtPCFBSJwegKaDE9Lb2vrel1RrEJ6s2V9KaWoH78TgYcOPkNDv4" ,message: `Thanks for using for jonkk services and your verfication code is : ${req.query.otp}`, numbers : [`${req.query.phone_number}`]}
fast2sms.sendMessage(options).then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
console.log(req.query.phone_number)
})
app.listen(port, () => {
console.log(`server has been started at ${port}`)
})