Gathering detailed insights and metrics for fastify-sendgrid
Gathering detailed insights and metrics for fastify-sendgrid
npm install fastify-sendgrid
Typescript
Module System
Min. Node Version
Node Version
NPM Version
69.8
Supply Chain
90.7
Quality
75.4
Maintenance
50
Vulnerability
100
License
JavaScript (54.92%)
TypeScript (45.08%)
Total Downloads
3,224
Last Day
4
Last Week
13
Last Month
50
Last Year
946
3 Stars
5 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
fastify-sendgrid@1.0.4
Unpacked Size
15.20 kB
Size
5.72 kB
File Count
10
NPM Version
8.5.1
Node Version
17.6.0
Cumulative downloads
Total Downloads
Last day
0%
4
Compared to previous day
Last week
8.3%
13
Compared to previous week
Last month
72.4%
50
Compared to previous month
Last year
-30%
946
Compared to previous year
2
6
npm i fastify-sendgrid --save
yarn add fastify-sendgrid
The plugin supports the following Fastify
and sendgrid/mail
versions. Please refer to corresponding branch in PR and issues.
version | branch | fastify | sendgrid/mail | End of support |
---|---|---|---|---|
1.x | [maain](https://github.com/Zebedeu/fastify-sendgrid | 4.x | ^7.7.0 |
Add it to you project with register
and you are done!
You can access via fastify.sendgrid
and send() via fastify.sendgrid.send()
. and reply.sendgrid.send()
.
1const fastify = require('fastify')() 2 3fastify.register(require('fastify-sendgrid'), { 4 apiKey: "" 5}) 6 7fastify.get('/sendmail/:email', (req, reply, next) => { 8 let { sendgrid } = fastify 9 let recipient = req.params.email 10 11 const msg = { 12 to: recipient, 13 from: 'example@gmail.com', // Use the email address or domain you verified above 14 subject: 'Sending with Twilio SendGrid is Fun', 15 text: 'and easy to do anywhere, even with Node.js', 16 html: '<strong>and easy to do anywhere, even with Node.js</strong>', 17 }; 18 //ES6 19 sendgrid 20 .send(msg) 21 .then(() => {}, error => { 22 console.error(error); 23 24 if (error.response) { 25 console.error(error.response.body) 26 } 27 }); 28 //ES8 29 (async () => { 30 try { 31 await sendgrid.send(msg); 32 } catch (error) { 33 console.error(error); 34 35 if (error.response) { 36 console.error(error.response.body) 37 } 38 } 39 })(); 40}) 41 42fastify.listen(3000, err => { 43 if (err) throw err 44 console.log(`server listening on ${fastify.server.address().port}`) 45})
Licensed under MIT.
No vulnerabilities found.
No security vulnerabilities found.