Advertisement
Guest User

Untitled

a guest
May 23rd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ### Prereqs
  2. npm install dotenv
  3.  
  4. ## Cloudant (DB)
  5.  
  6. Before querying the cloudant db, Create a cloudant DB and follow the steps below,
  7. create a .env file with your Cloudant credentials in the root directory.
  8. ```
  9. cloudant_username=myaccount # Replace myaccount with your account name
  10. cloudant_password='secret' # Replace secret with your password
  11. ```
  12. or on a terminal
  13. ```
  14. echo "/.env" >> .gitignore # Do not track .env in the revision history
  15. echo "cloudant_username=myaccount" > .env # Replace myaccount with your account name
  16. echo "cloudant_password='secret'" >> .env # Replace secret with your password
  17. ```
  18. ### Credentials in app.js
  19. require('dotenv').load();
  20.  
  21. // Load the Cloudant library.
  22. var Cloudant = require('cloudant');
  23.  
  24. var username = process.env.cloudant_username;
  25. var password = process.env.cloudant_password;
  26.  
  27. // Initialize the library
  28. var cloudant = Cloudant({
  29. account: username,
  30. password: password
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement