Last active
December 12, 2020 07:16
-
-
Save kidGodzilla/36da0bcb036e15811c61360a8212e081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @api {get} /freemail/:email isFreeMail | |
* @apiDescription Tests a domain to see if it's a free email or disposible email address | |
* @apiGroup Utility | |
* @apiExample {REST} Example usage: | |
GET https://api.meetingroom365.com/freemail/foo@gmail.com | |
* @apiParam {String} email The email address you wish to check | |
* @apiVersion 0.5.0 | |
* @apiSuccessExample {json} Success | |
*HTTP/1.1 200 OK | |
{ | |
email: "foo@gmail.com", | |
isFree: true, | |
isDisposable: false | |
} | |
*/ | |
app.get('/freemail/:email', (req, res) => { | |
let { email } = req.params; | |
const freemail = require('freemail'); | |
if (!email.includes('@')) email = 'foo@' + email; | |
res.send({ | |
email: email, | |
isFree: freemail.isFree(email), | |
isDisposable: freemail.isDisposable(email) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is just a little Express endpoint that handles free / disposable email checking.