Add SendGrid to Your Node.js Applications With Modulus
Modulus is a platform-as-a-service (PaaS) that allows you to easily host, deploy, scale and monitor your Node.js applications. The Modulus platform is ideally suited for developers that are building real-time mobile, SaaS, social and big data apps that run across distributed devices and require built-in performance monitoring and powerful analytics.
Modulus is offered both as a hosted service and can be deployed by enterprises in public, private and hybrid clouds as well as on-premise. For the enterprise, Modulus provides a unique offering with a licensed enterprise Node.js PaaS, allowing businesses and ISVs to deploy next-generation apps faster and at a lower total cost.
Benefits of Partnership
With SendGrid powering email for applications on the Modulus platform, developers will now be able to deploy their app and easily deliver email into the inbox without needing to set up and manage their own SMTP servers or worry about delivery rates, spam folders, ISP blacklists, or scaling to meet high user volume - all resulting in more time available to create and scale their awesome applications.
We’ve created a simple tutorial using a sample app on GitHub, to show you how to integrate SendGrid in an app being built on Modulus.io.
To run this app on Modulus follow the next steps:
1) Install the Modulus CLI tool if you do not already have it:
$ npm install -g modulus
2) Login with Modulus credentials:
$ modulus login Welcome to Modulus [?] Enter your username or email: username/email [?] Enter your password: [✓] Signed in as user ... # Or with your github credentials: $ modulus login --github Welcome to Modulus [?] Enter your GitHub username or email: username/email [?] Enter your password: [✓] Signed in as user ...
3) Clone the sample app repo on your local dev environment.
$ git clone https://github.com/fiveisprime/sendgrid-example.git $ cd sendgrid-example/
4) Create a new project to deploy it on Modulus.
$ modulus project create sendgrid_sample_app
5) Provision the SendGrid Addon
$ modulus addons add sendgrid:free
When the addon is provisioned, the environment of the project is modified to include the following variables: SENDGRID_USERNAME, SENDGRID_PASSWORD
In addition to Free, other SendGrid plans are available for provision:
6) Deploy the application to Modulus.io:
$ modulus deploy
After deploy, you can see the app on modulus interface:
7) Access the URL provided at the end of the deploy process:
[✓] sendgrid_sample_app running at sendgrid_sample_app-xxxx.onmodulus.net
And you should see this form:
Now you can test sending and email.
Your SendGrid credentials are taken automatically from the environment parameters:
var sendgrid = require('sendgrid')( process.env.SENDGRID_USERNAME, process.env.SENDGRID_PASSWORD );
Your message will be sent, waiting for you to open it.
This basic tutorial shows you how simple it is to incorporate SendGrid email into your application. As a next step, start building email into your own awesome node.js application on Modulus.io.
Getting started is simple. Sign up now with a free SendGrid account and $15 Free Modulus Credits.