Advertisement
ferrojr

Untitled

Apr 27th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.33 KB | None | 0 0
  1. var express = require('express');
  2. var ParseServer = require('parse-server').ParseServer;
  3. var app = express();
  4. // Specify the connection string for your mongodb database
  5. // and the location to your Parse cloud code
  6.  
  7. var databaseUri = process.env.DATABASE_URI || 'private';
  8.  
  9.  
  10. var S3Adapter = require('parse-server').S3Adapter;
  11.  
  12. var api = new ParseServer({
  13. databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  14. cloud: "/opt/bitnami/apps/parse/htdocs/cloud/main.js",
  15. appId: "private",
  16. masterKey: "private",
  17. fileKey: "8639157b-cef3-4b3e-9f23-c1c83085f886",
  18. enableAnonymousUsers: false,
  19. verifyUserEmails: true,
  20. appName: 'IronTrainers',
  21. serverURL: "private" || 'http://localhost:1337/parse',
  22. publicServerURL: "private",
  23. liveQuery: {
  24. classNames: ["UserConfig", "StaffITMessages"] // List of classes to support for query subscriptions
  25. },
  26.  
  27. push: {
  28. ios: [
  29. {
  30. pfx: '/opt/bitnami/apps/parse/htdocs/certificates/IronTrainersCertificate.p12', // Dev PFX or P12
  31. topic: '-.IRON-TRAINERS',
  32. production: true // Dev
  33. },
  34. {
  35. pfx: '/opt/bitnami/apps/parse/htdocs/certificates/IronTrainersCertificate.p12', // Dev PFX or P12
  36. topic: '-.IRON-TRAINERS',
  37. production: false // Dev
  38. }//,
  39. //{
  40. // topic: 'apps.IT-Medical',
  41. // production: true // Prod
  42. // }
  43. ],
  44. android:
  45. {
  46. senderId: '407700652754',
  47. apiKey:'private-E0'
  48. }
  49. },
  50. filesAdapter: new S3Adapter(
  51. "private",
  52. "private",
  53. "parse-prod-iron",
  54. {
  55. directAccess: true,
  56. region: "sa-east-1"
  57. }
  58. ),
  59. emailAdapter: {
  60. module: 'parse-server-amazon-ses-email-adapter',
  61. options: {
  62. // The address that your emails come from
  63. fromAddress: 'Iron Trainers <private>',
  64. accessKeyId: 'private',
  65. secretAccessKey: 'private',
  66. region: 'eu-west-1',
  67. // The template section
  68. templates: {
  69. passwordResetEmail: {
  70. subject: 'Redefinir sua senha Iron Trainers',
  71. pathPlainText: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/password_reset_email.txt',
  72. pathHtml: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/password_reset_email.html',
  73. callback: (user) => {
  74. return {
  75. nome: user.get("nome"),
  76. sobrenome: user.get("sobrenome")
  77. }
  78. }
  79. // Now you can use {{firstName}} in your templates
  80. },
  81. verificationEmail: {
  82. subject: 'Confirmar email no Iron Trainers',
  83. pathPlainText: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/verification_email.txt',
  84. pathHtml: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/resendEmailVerification.html',
  85. pathHtml_en: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/resendEmailVerification.html',
  86. callback: (user) => {
  87. return {
  88. nome: user.get('nome'),
  89. teste: 'this is a test',
  90. }
  91. }
  92. // Now you can use {{firstName}} in your templates
  93. },
  94. customEmailAlert: {
  95. subject: 'Urgent notification!',
  96. pathPlainText: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/custom_alert.txt',
  97. pathHtml: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/custom_alert.html',
  98. callback: (user) => {
  99. return {
  100. nome: user.get("nome"),
  101. sobrenome: user.get("sobrenome")
  102. }
  103. }
  104. }
  105. }
  106. }
  107. },
  108. customPages: {
  109. invalidLink: 'http://irontrainers.com.br/members/invalid_link.html',
  110. verifyEmailSuccess: 'http://irontrainers.com.br/members/verify_email_success.html',
  111. choosePassword: 'http://irontrainers.com.br/members/choose_password.html',
  112. passwordResetSuccess: 'http://irontrainers.com.br/members/password_reset_success.html'
  113. }// JavaScript Document
  114. });
  115.  
  116.  
  117. process.on('unhandledRejection', (reason, p) => {
  118. console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
  119. // application specific logging, throwing an error, or other logic here
  120. });
  121.  
  122. // Serve the Parse API on the /parse URL prefix
  123. app.use('/parse', api);
  124.  
  125. var allowInsecureHTTP = true;
  126. var port = 1337;
  127. app.listen(port, function() {
  128. console.log('parse-server running on port ' + port);
  129. });
  130.  
  131. //Parse Dashboard
  132. var ParseDashboard = require('parse-dashboard');
  133. var dashboard = new ParseDashboard({
  134. apps: [
  135. {
  136. appName: "My Bitnami Parse API",
  137. appId: "private",
  138. masterKey: "private",
  139. fileKey: "private-cef3-4b3e-9f23-private",
  140. production: true,
  141. serverURL: "private"
  142. }
  143. ],
  144. users: [
  145. {
  146. user: "private",
  147. pass: "private"
  148. }
  149. ], useEncryptedPasswords: false
  150. }, allowInsecureHTTP);
  151.  
  152.  
  153. //var allowInsecureHTTP = true;
  154.  
  155. // Serve the Parse Dashboard on the /parsedashboard URL prefix
  156. app.use('/', dashboard);
  157.  
  158. var portdash = 4040;
  159. app.listen(portdash, function() {
  160. console.log('parse-dashboard running on port ' + portdash);
  161. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement