faq.ejs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <div id="faq">
  2. <div class="container">
  3. <h1>FAQ</h1>
  4. <div class="q-and-a">
  5. <hr/>
  6. <h4>What is this page for?</h4>
  7. <p>This is a template for building your own "Frequently Asked Questions" page. It was generated automatically as part of the expanded seed app provided by <a href="https://sailsjs.com/about">Sails</a>. On top of its primary purpose as a template, this page doubles as a handy guide about the seed app itself.</p>
  8. <p><small>Before you deploy this app to production, be sure to replace the content on this page with real questions and answers that are relevant to your project. Or if you don't need an FAQ, just delete this file altogether.</small></p>
  9. </div>
  10. <div class="q-and-a">
  11. <hr/>
  12. <h4>Other than Sails, what technologies, frameworks, or services does this app rely on?</h4>
  13. <p>This app includes several tools and integrations that we use frequently on top of Sails. They've worked well for us in the past; allowing us to focus on developing new features with minimal overhead. Some are files we've rolled ourselves, and the rest are 3rd party services and frameworks. While a couple of these will require you to make an account (or obtain an API key, etc.), we want to emphasize that we only included trusted, reliable tools that we feel comfortable using on our own projects, and our customers' projects.</p>
  14. <ul>
  15. <li><a target="_blank" href="http://getbootstrap.com/docs/4.0/getting-started/introduction/"><strong>Bootstrap 4</strong></a> - Front-end component library</li>
  16. <li><a target="_blank" href="http://fontawesome.io/icons/"><strong>Font Awesome</strong></a> - Icons</li>
  17. <li><a target="_blank" href="https://vuejs.org/"><strong>Vue.js</strong></a> - Front-end framework</li>
  18. <li><a target="_blank" href="https://npmjs.com/package/parasails"><strong>parasails.js</strong></a> - Thin layer of bundled conventions for using Vue.js with Sails.js</li>
  19. <li><strong>cloud.js</strong> - Dynamically-generated SDK for handling requests from the front-end to the actions in your Sails app. (More info on usage below.)</li>
  20. <li><a target="_blank" href="https://www.mailgun.com/"><strong>Mailgun</strong></a>* - Emails</li>
  21. <li><a target="_blank" href="https://stripe.com/docs"><strong>Stripe</strong></a>* - Payments</li>
  22. </ul>
  23. <p><small>* requires an API key</small></p>
  24. </div>
  25. <div class="q-and-a">
  26. <hr/>
  27. <h4>How do I configure a new method to use with cloud.js?</h4>
  28. <p>Once you've created a controller action and added it to your routes (see the <a target="_blank" href="https://sailsjs.com/documentation/concepts/routes">Sails.js docs for more info on how to do that</a>), there are just a few simple steps to add it to your global <code>Cloud</code> SDK:</p>
  29. <ul>
  30. <li>Rebuild this app's custom SDK using <code>sails run scripts/rebuild-cloud-sdk</code>. (This automatically regenerates the method definitions in your <code>assets/js/cloud.setup.js</code> file based on your configured routes.)</li>
  31. <li>You can then call any relevant new actions as "cloud methods" in your frontend code like so: <code>await Cloud.doSomething.with({…})</code></li>
  32. </ul>
  33. </div>
  34. <div class="q-and-a">
  35. <hr/>
  36. <h4>How do I register a new page with parasails.js?</h4>
  37. <p>To generate files for a new page (for example, "hotels-overview"), run:</p>
  38. <p><code>sails generate page hotels-overview</code></p>
  39. <p>Then you can add a route for the new view action to make it accessible from the browser. For example:</p>
  40. <p><code>'GET /hotels': { action: 'view-hotels-overview' }</code></p>
  41. <p><small>To register a new page without the generator, make sure the top-level element of the view you wish to register has an <code>id</code> property (e.g. <code>&lt;div id="my-new-page"&gt;...&lt;/div&gt;</code>). Then, create a new javascript file, and include <code>parasails.registerPage('my-new-page', { /* options for the Vue.js instance */ })</code>. For more thorough examples, dig around in <code>assets/js/pages/</code>.</small></p>
  42. </div>
  43. <div class="q-and-a">
  44. <hr/>
  45. <h4>How do I deploy to Heroku?</h4>
  46. <p>In your <a target="_blank" href="https://dashboard.heroku.com">Heroku dashboard</a>, configure your app to auto-deploy from the <code>deploy</code> branch of this project's GitHub repository. Then, from the command line, run <code>sails run deploy</code>.</p>
  47. <p>For more deployment tips, <a href="https://sailsjs.com/documentation/concepts/deployment">click here</a>.</p>
  48. </div>
  49. <div class="q-and-a">
  50. <hr/>
  51. <h4>Do I have to host on Heroku?</h4>
  52. <p>No way! You can deploy your app <a target="_blank" href="https://sailsjs.com/documentation/concepts/deployment/hosting">anywhere that supports Node.js</a>.</p>
  53. </div>
  54. <div class="q-and-a">
  55. <hr/>
  56. <h4>How do I verify my user's email addresses?</h4>
  57. <p>By default, email verification is neither required for signup, nor for when an existing user changes their email address from their account page. To enable an email verification step for both of these actions, open <code>config/custom.js</code> and change <code>verifyEmailAddresses: false</code> to <code>verifyEmailAddresses: true</code>.</p>
  58. </div>
  59. <div class="q-and-a">
  60. <hr/>
  61. <h4>How do I finish setting up Mailgun?</h4>
  62. <p>To use Mailgun, you'll need to <a target="_blank" href="https://www.mailgun.com/">sign up for an account</a>. (While this <em>is</em> a paid service at higher usage levels, you should be able to use Mailgun as much as you need to in development without having to provide any credit card information.)</p>
  63. <p>After you've created an account, you'll need to add your Mailgun domain and API secret to your custom config. (In development, this will be either in <code>config/custom.js</code>, or in a <code>local.js</code> file you add to your <code>config/</code> folder. For your staging or production deployment, you'll want to set these using system environment variables -- aka "config variables" in Heroku.)</p>
  64. <p>If you already own a domain for your app, you can follow Mailgun's instructions for configuring a sending domain.</p>
  65. <p>Otherwise, to send emails from this app <em>without</em> configuring a sending domain, you can use the sandbox domain &amp; test API secret that comes with your Mailgun account. Just be sure to configure the authorized recipents for your sandbox domain first, or there will be errors from the endpoints that attempt to send emails.</p>
  66. </div>
  67. <div class="q-and-a">
  68. <hr/>
  69. <h4>How do I finish setting up Stripe?</h4>
  70. <p>To use Stripe for your app's payment processing, you'll need to <a target="_blank" href="https://stripe.com">sign up for an account</a>.</p>
  71. <p>Once you have an account, you'll need to include your publishable and secret keys in your app's custom config as <code>sails.config.custom.stripePublishableKey</code> and <code>sails.config.custom.stripeSecret</code>. In development, you can add your test keys to <code>config/custom.js</code>, or in a <code>local.js</code> file you add to your <code>config/</code> folder.</p>
  72. <p>In your staging or production deployment, you'll want to set your API keys using system environment variables (aka "config variables" in Heroku), and you will need ensure that your site meets Stripe's HTTPS requirements in order for Stripe Checkout to work. For more information, see Stripe's <a target="_blank" href="https://stripe.com/docs/checkout">Detailed Checkout Guide</a>.</p>
  73. </div>
  74. <div class="q-and-a">
  75. <hr/>
  76. <h4>How do I disable ___________?</h4>
  77. <p class="pt-4 text-muted"><strong><em>To disable the Bootstrap framework:</em></strong></p>
  78. <ul>
  79. <li>Delete the folder <code>assets/dependencies/bootstrap/</code></li>
  80. <li>In <code>tasks/pipeline.js</code>, delete <code>'dependencies/bootstrap/dependencies/**/*.js',</code> from <code>jsFilesToInject</code></li>
  81. </ul>
  82. <p class="pt-4 text-muted"><strong><em>To disable FontAwesome:</em></strong></p>
  83. <ul>
  84. <li>In the <code>&lt;head&gt;</code> of <code>layouts/layout.ejs</code>, delete the link labeled <code>&lt;!-- Font Awesome --&gt;</code></li>
  85. </ul>
  86. <p class="pt-4 text-muted"><strong><em>To swap out Mailgun:</em></strong></p>
  87. <p>We chose Mailgun because of its very generous free tier (you can send up to 10,000 emails per month). Plus it integrates easily, it's been around for a while (so it's stable and does a good job evading spam filters), and it's used internally at companies like GitHub and Heroku.</p>
  88. <p>Out-of-the box, if Mailgun is not configured for this app, the contact form and password recovery flow will fail outright unless an email address ending in "@example.com" is used. Luckily, if you wish to use <a target="_blank" href="https://stackshare.io/mailgun/alternatives">a different solution for sending automated emails</a>, the logic for sending emails is fairly contained. To switch to a service other than Mailgun, you'll need to make the following changes to your code:</p>
  89. <ul>
  90. <li>Modify the code in <code>api/helpers/send-template-email.js</code> to use the email service of your choice.</li>
  91. <li>In <code>api/hooks/custom/index.js</code>, remove the warnings related to Mailgun.</li>
  92. </ul>
  93. <p class="pt-4 text-muted"><strong><em>To remove or replace Stripe integration:</em></strong></p>
  94. <p>We chose Stripe because it is the easiest-to-integrate payment processor in the industry. Its rates are about the same <a target="_blank" href="https://stackshare.io/stripe/alternatives">as its competitors'</a>, but even if that weren't the case, Stripe's focus on developer happiness would probably make up for it. Stripe processes payments, payouts, and more for <a target="_blank" href="https://stripe.com/us/customers">hundreds of thousands of businesses</a> all around the world.</p>
  95. <p>By default, features related to billing are automatically disabled if you don't have a Stripe publishable key &amp; secret key in your custom config (<code>sails.config.custom.stripePublishableKey</code> and <code>sails.config.custom.stripeSecret</code>, respectively). Your app will not be negatively impacted or appear broken; it will merely have some extraneous code in places. If you don't anticipate integrating billing features into your app and want to remove this code entirely, you can make the following changes:</p>
  96. <ul>
  97. <li>In the <code>User</code> model definition at <code>api/models/User.js</code>, remove the <code>stripeCustomerId</code>, <code>billingCardBrand</code>, <code>billingCardLast4</code>, <code>billingCardExpMonth</code>, and <code>billingCardExpYear</code> attribute definitions.</li>
  98. <li>In the signup controller at <code>api/controllers/entrance/signup.js</code>:
  99. <ul>
  100. <li>Remove the line at the top requiring the Stripe dependency</li>
  101. <li>Remove the block of code creating a Stripe customer. (If you have trouble finding where this happens, be sure to read the comments.)</li>
  102. <li>In the call to <code>User.create()</code>, remove the <code>stripeCustomerId</code> property.</li>
  103. </ul>
  104. </li>
  105. <li>In the confirm email controller at <code>api/controllers/entrance/confirm-email.js</code>:
  106. <ul>
  107. <li>Remove the line at the top requiring the Stripe dependency.</li>
  108. <li>Remove the block of code that handles creating/updating a Stripe customer. (If you have trouble finding where this happens, be sure to read the comments.)</li>
  109. </ul>
  110. </li>
  111. <li>Remove the update billing card endpoint and all references to it by doing the following:
  112. <ul>
  113. <li>Delete the file at <code>api/account/update-billing-card.js</code>.</li>
  114. <li>In <code>config/routes.js</code>, delete the route configuration for <code>'PUT /api/v1/account/update-billing-card'</code>.</li>
  115. <li>In <code>assets/js/cloud.setup.js</code>, delete the <code>updateBillingCard</code> method.</li>
  116. <li>In <code>assets/js/pages/account/my-account.page.js</code>, remove the <code>clickStripeCheckoutButton</code> method.</li>
  117. <li>In <code>views/pages/account/my-account.ejs</code>, remove the HTML related to billing.</li>
  118. </ul>
  119. </li>
  120. <li>In <code>api/hooks/custom/index.js</code>, remove the warnings related to Stripe.</li>
  121. <li>In <code>api/hooks/custom/index.js</code>, remove <code>sails.config.custom.enableBillingFeatures = !isMissingStripeConfig;</code>.</li>
  122. </ul>
  123. </div>
  124. <div class="q-and-a">
  125. <hr/>
  126. <h4>Where can I go for more help?</h4>
  127. <p>If you run into trouble, you can often find the answer in the <a target="_blank" href="http://sailsjs.com/documentation">Sails.js documentation</a>. If you're unsure about how to proceed, or completely stumped, be sure to check out the <a target="_blank" href="http://sailsjs.com/support">latest available resources</a>.</p>
  128. </div>
  129. </div>
  130. </div>
  131. <%- /* Expose locals as `window.SAILS_LOCALS` :: */ exposeLocalsToBrowser() %>