Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Interacting with Force.com through a React/Node.js application

As a developer you may want build and deploy you own web application that interacts with Force.com APIs. Join this presentation to learn how you can develop such a project based on a React frontend and a Node.js backend. I will describe the journey from implementation to deployment on Heroku.

Video: https://success.salesforce.com/Sessions?eventId=a1Q3000000qQOd9#/session/a2q3A000000LBjGQAW

  • Login to see the comments

  • Be the first to like this

Interacting with Force.com through a React/Node.js application

  1. 1. Interacting with Force.com through a React/Node.js application Philippe Ozil Developer Evangelist @PhilippeOzil pozil@salesforce.com
  2. 2. Forward-Looking Statements Statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non- salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  3. 3. Agenda Motivation & Goals Demo Project Architecture React Frontend Node.js Backend Heroku Deployment Closing Words
  4. 4. Motivation & Goals Original intent • Learn React • Drive a React app with Force.com Obstacle Lack of documentation for full stack integration Goals • Detail frontend & backend implementation • Cover common use cases
  5. 5. Demo https://sfdc-react-integration.herokuapp.com
  6. 6. Project Architecture
  7. 7. Architecture Constraints Typical web app Frontend + backend Force.com authentication OAuth 2.0 + Force.com Connected Application Keep app in the Cloud Heroku hosting
  8. 8. Architecture Overview Frontend Force.comBackend
  9. 9. React Frontend
  10. 10. Quick React Overview Open source JS library created by Facebook Popular alternative to AngularJS React Fey concepts: Component State Property Child component State Property Callback functionVariable
  11. 11. Quick React Overview (Continued) JSX – JS XML preprocessor
  12. 12. React Application React App Nav bar Query form Query result Login panel
  13. 13. React Code Example – App component
  14. 14. React Code Example – App component
  15. 15. React Code Example – App component
  16. 16. Backend Interactions React App Node App /auth/whoami /query Nav bar Query form Query result React component /auth/login /auth/logout Login panel HTTP Endpoint Navigates to REST call Navigates to REST call
  17. 17. Node.js backend
  18. 18. Quick Node.js Overview Open source JS runtime environment • Multi-platform • Event-driven • Asynchronous I/O • Wide range of modules/applications
  19. 19. Node Application Node App /auth/whoami /query /auth/logout /auth/login /auth/callback HTTP EndpointNode module salesforce-node-client auth data
  20. 20. Node Interactions Node App /auth/whoami /query /auth/logout /auth/login /auth/callback OAuth2 Data Force.com serviceHTTP EndpointNode module salesforce-node-client auth data 1 2 34 5 6
  21. 21. Node Code Example - Authentication 1 2 3 4 5 6
  22. 22. Heroku Deployment
  23. 23. Quick Heroku Overview Company part of Salesforce Cloud PaaS • Runtimes • Databases • Build tools
  24. 24. Heroku Deployment 1. Push code to GitHub
  25. 25. Heroku Deployment 1. Push code to GitHub 2. Set Connected App & OAuth settings
  26. 26. Heroku Deployment 1. Push code to GitHub 2. Set Connected App & OAuth settings 3. Connect Heroku with GitHub
  27. 27. Heroku Deployment 1. Push code to GitHub 2. Set Connected App & OAuth settings 3. Connect Heroku with GitHub 4. Setup Heroku deploy
  28. 28. Closing word
  29. 29. Conclusion • From development to deployment • Low code volume • JS build environment setup = pain • Heroku deployment = piece of cake • Try out & fork this project!
  30. 30. Resources Sample Node/React application github.com/pozil/salesforce-react-integration Reusable Salesforce Node client github.com/pozil/salesforce-node-client
  31. 31. Thank Y u

×