Archive
Tags
Salesforce Lightning Out with Heroku Node.js
March 11, 2018
We recently started to play around with Salesforce Lightning Out.
To get up and running (from scratch) took no longer than a couple of hours, and now we have a template to apply to future projects.
So what is Salesforce Lightning Out?
As per the Salesforce developer documentation:
You can use Lightning Out to run Lightning components apps outside of Salesforce servers. Whether it's a Node.js app running on Heroku, a department server inside the firewall, or even SharePoint, build your custom app with Lightning Platform and run it wherever your users are.
This means that we can build a lighting component, use it in a record page, a community, Salesforce mobile app and now even on an external web server.
To get started we need to create a Lightning App. Check out the lightning app we created over here.
This app has a simple dependency to a Lightning Component we created here.
After we deploy this to our Salesforce Dev or Scratch Org we can now proceed to setup the second part, refer to post deployment steps.
Before proceeding you must have a My Domain setup as well as Community setup.
Now we need to setup a Node.js server on Heroku. Check out the server code that can be deployed straight to Heroku here.
Please note that there are pre and post deployment steps. The community and lightning URLs must be replaced.
Once deployed to Heroku simply open the Heroku app. As a demo we have used this.
This demo does not include authentication but you could easily apply authentication via ForceJS or OAuth. Perfect use case with External Identities!
Useful links:
Happy coding!
Recent Posts
November 19, 2018
October 29, 2018
October 29, 2018
JOIN OUR NEWSLETTER!