-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (24 loc) · 846 Bytes
/
index.js
File metadata and controls
32 lines (24 loc) · 846 Bytes
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
31
32
/**
* Using Identibyte in a Node.js application
*
* This example shows how you can integrate Identibyte with a Node.js
* application by making a simple HTTP request to the /checks endpoint
* to see if an email is disposable.
*/
const https = require('https')
const email = 'email@mailinator.com'
const requestOptions = {
host: 'identibyte.com',
path: '/check/' + email + '?api_token=' + YOUR_API_TOKEN,
}
// Make the API request and wait for the response
https.get(requestOptions, (res) => {
let body = ''
res.on('data', chunk => body += chunk)
// Print if the email address is disposable or not
res.on('end', () => {
const response = JSON.parse(body)
const disposable = response.email.disposable === true ? 'Yes' : 'No'
console.log(`Is ${email} disposable? ${disposable}`)
})
})