Guest User

Untitled

a guest
Feb 16th, 2018
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.56 KB | None | 0 0
  1. var express = require('express');
  2. var cors = require('cors')
  3.  
  4. var app = express();
  5. var morgan = require('morgan');
  6.  
  7. app.use(morgan('dev'));
  8.  
  9. var port = process.env.PORT || 3007;
  10. var mongoose = require('mongoose');
  11.  
  12. //MONGOLAB_URI='mongodb://foo:fff@ds163612.mlab.com:63615/cars';
  13. mongoose.connect(MONGOLAB_URI, function (error) {
  14. if (error) console.error(error);
  15. else console.log('mongo connected');
  16. });
  17.  
  18.  
  19. var db = mongoose.connection;
  20. db.on('error', console.error.bind(console, 'connection error:'));
  21.  
  22. db.once('open', function() {
  23. console.log("DB connection alive");
  24. });
  25.  
  26. // var User = require('./model/user');
  27. var Message = require('./model/message');
  28. var Car = require('./model/car');
  29.  
  30. var router = express.Router();
  31.  
  32. app.get('/',cors(),function(req, res) {
  33.  
  34. Car.find(function(err, cars) {
  35. if (err)
  36. res.send(err);
  37.  
  38. res.json(cars);
  39. });
  40. });
  41. app.get('/messages',cors(),function(req, res) {
  42. Message.find(function(err, messages) {
  43. if (err)
  44. res.send(err);
  45.  
  46. res.json(messages);
  47. });
  48. });
  49.  
  50. app.get('/cars',cors(),function(req, res) {
  51. Car.find(function(err, cars) {
  52. if (err)
  53. res.send(err);
  54.  
  55. res.json(cars);
  56. });
  57. });
  58.  
  59.  
  60.  
  61.  
  62. app.listen(port);
  63. console.log('Magic happens on port ' + port);
  64.  
  65. 2018-02-16T08:28:52.841304+00:00 app[api]: Release v31 created by user foo@gmail.com
  66. 2018-02-16T08:28:52.841304+00:00 app[api]: Deploy 5f779472 by user foo@gmail.com
  67. 2018-02-16T08:28:42.000000+00:00 app[api]: Build succeeded
  68. 2018-02-16T08:28:53.326343+00:00 heroku[web.1]: Restarting
  69. 2018-02-16T08:28:53.327265+00:00 heroku[web.1]: State changed from up to starting
  70. 2018-02-16T08:28:54.189659+00:00 heroku[web.1]: Stopping all processes with SIGTERM
  71. 2018-02-16T08:28:54.296051+00:00 heroku[web.1]: Process exited with status 143
  72. 2018-02-16T08:28:55.360118+00:00 heroku[web.1]: Starting process with command `npm start`
  73. 2018-02-16T08:28:57.304833+00:00 app[web.1]:
  74. 2018-02-16T08:28:57.304857+00:00 app[web.1]: > react-deploy-test@1.0.0 start /app
  75. 2018-02-16T08:28:57.304861+00:00 app[web.1]: > node server.js
  76. 2018-02-16T08:28:57.304862+00:00 app[web.1]:
  77. 2018-02-16T08:28:57.847783+00:00 app[web.1]: Magic happens on port 27591
  78. 2018-02-16T08:28:57.941605+00:00 app[web.1]: DB connection alive
  79. 2018-02-16T08:28:57.941955+00:00 app[web.1]: mongo connected
  80. 2018-02-16T08:28:58.502415+00:00 heroku[web.1]: State changed from starting to up
  81. 2018-02-16T08:31:01.000000+00:00 app[api]: Build started by user foo@gmail.com
  82. 2018-02-16T08:31:11.871346+00:00 app[api]: Deploy 30ad9492 by user foo@gmail.com
  83. 2018-02-16T08:31:11.871346+00:00 app[api]: Release v32 created by user foo@gmail.com
  84. 2018-02-16T08:31:01.000000+00:00 app[api]: Build succeeded
  85. 2018-02-16T08:31:13.173487+00:00 heroku[web.1]: Restarting
  86. 2018-02-16T08:31:13.174022+00:00 heroku[web.1]: State changed from up to starting
  87. 2018-02-16T08:31:14.080217+00:00 heroku[web.1]: Stopping all processes with SIGTERM
  88. 2018-02-16T08:31:14.203672+00:00 heroku[web.1]: Process exited with status 143
  89. 2018-02-16T08:31:15.886400+00:00 heroku[web.1]: Starting process with command `npm start`
  90. 2018-02-16T08:31:18.456384+00:00 app[web.1]:
  91. 2018-02-16T08:31:18.456429+00:00 app[web.1]: > react-deploy-test@1.0.0 start /app
  92. 2018-02-16T08:31:18.456431+00:00 app[web.1]: > node server.js
  93. 2018-02-16T08:31:18.456433+00:00 app[web.1]:
  94. 2018-02-16T08:31:19.161125+00:00 app[web.1]: Magic happens on port 45873
  95. 2018-02-16T08:31:19.164986+00:00 app[web.1]: TypeError: Parameter "url" must be a string, not undefined
  96. 2018-02-16T08:31:19.164990+00:00 app[web.1]: at Url.parse (url.js:103:11)
  97. 2018-02-16T08:31:19.164992+00:00 app[web.1]: at Object.urlParse [as parse] (url.js:97:13)
  98. 2018-02-16T08:31:19.164994+00:00 app[web.1]: at module.exports (/app/node_modules/mongodb/lib/url_parser.js:13:23)
  99. 2018-02-16T08:31:19.164997+00:00 app[web.1]: at new Promise (<anonymous>)
  100. 2018-02-16T08:31:19.164995+00:00 app[web.1]: at Promise (/app/node_modules/mongoose/lib/connection.js:332:5)
  101. 2018-02-16T08:31:19.164999+00:00 app[web.1]: at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:331:19)
  102. 2018-02-16T08:31:19.165001+00:00 app[web.1]: at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:206:15)
  103. 2018-02-16T08:31:19.165002+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:14:10)
  104. 2018-02-16T08:31:19.165004+00:00 app[web.1]: at Module._compile (module.js:643:30)
  105. 2018-02-16T08:31:19.165006+00:00 app[web.1]: at Object.Module._extensions..js (module.js:654:10)
  106. 2018-02-16T08:31:19.165007+00:00 app[web.1]: at Module.load (module.js:556:32)
  107. 2018-02-16T08:31:19.165009+00:00 app[web.1]: at tryModuleLoad (module.js:499:12)
  108. 2018-02-16T08:31:19.165010+00:00 app[web.1]: at Function.Module._load (module.js:491:3)
  109. 2018-02-16T08:31:19.165012+00:00 app[web.1]: at Function.Module.runMain (module.js:684:10)
  110. 2018-02-16T08:31:19.165014+00:00 app[web.1]: at startup (bootstrap_node.js:187:16)
  111. 2018-02-16T08:31:19.165015+00:00 app[web.1]: at bootstrap_node.js:608:3
  112. 2018-02-16T08:31:19.167672+00:00 app[web.1]: (node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Parameter "url" must be a string, not undefined
  113. 2018-02-16T08:31:19.167809+00:00 app[web.1]: (node:20) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  114. 2018-02-16T08:31:19.566292+00:00 heroku[web.1]: State changed from starting to up
  115. 2018-02-16T08:32:28.000000+00:00 app[api]: Build started by user foo@gmail.com
  116. 2018-02-16T08:32:40.526330+00:00 app[api]: Deploy 3fe92549 by user foo@gmail.com
  117. 2018-02-16T08:32:40.526330+00:00 app[api]: Release v33 created by user foo@gmail.com
  118. 2018-02-16T08:32:41.917774+00:00 heroku[web.1]: Restarting
  119. 2018-02-16T08:32:41.919583+00:00 heroku[web.1]: State changed from up to starting
  120. 2018-02-16T08:32:28.000000+00:00 app[api]: Build succeeded
  121. 2018-02-16T08:32:42.673705+00:00 heroku[web.1]: Stopping all processes with SIGTERM
  122. 2018-02-16T08:32:42.777505+00:00 heroku[web.1]: Process exited with status 143
  123. 2018-02-16T08:32:45.105809+00:00 heroku[web.1]: Starting process with command `npm start`
  124. 2018-02-16T08:32:47.705781+00:00 app[web.1]:
  125. 2018-02-16T08:32:47.705800+00:00 app[web.1]: > react-deploy-test@1.0.0 start /app
  126. 2018-02-16T08:32:47.705802+00:00 app[web.1]: > node server.js
  127. 2018-02-16T08:32:47.705804+00:00 app[web.1]:
  128. 2018-02-16T08:32:49.079895+00:00 app[web.1]: Magic happens on port 48220
  129. 2018-02-16T08:32:49.083923+00:00 app[web.1]: Error: Username contains an illegal unescaped character
  130. 2018-02-16T08:32:49.083926+00:00 app[web.1]: at parseConnectionString (/app/node_modules/mongodb/lib/url_parser.js:274:11)
  131. 2018-02-16T08:32:49.083929+00:00 app[web.1]: at parseHandler (/app/node_modules/mongodb/lib/url_parser.js:113:14)
  132. 2018-02-16T08:32:49.083932+00:00 app[web.1]: at Promise (/app/node_modules/mongoose/lib/connection.js:332:5)
  133. 2018-02-16T08:32:49.083930+00:00 app[web.1]: at module.exports (/app/node_modules/mongodb/lib/url_parser.js:19:12)
  134. 2018-02-16T08:32:49.083934+00:00 app[web.1]: at new Promise (<anonymous>)
  135. 2018-02-16T08:32:49.083936+00:00 app[web.1]: at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:331:19)
  136. 2018-02-16T08:32:49.083938+00:00 app[web.1]: at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:206:15)
  137. 2018-02-16T08:32:49.083940+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:14:10)
  138. 2018-02-16T08:32:49.083942+00:00 app[web.1]: at Module._compile (module.js:643:30)
  139. 2018-02-16T08:32:49.083944+00:00 app[web.1]: at Object.Module._extensions..js (module.js:654:10)
  140. 2018-02-16T08:32:49.083945+00:00 app[web.1]: at Module.load (module.js:556:32)
  141. 2018-02-16T08:32:49.083947+00:00 app[web.1]: at tryModuleLoad (module.js:499:12)
  142. 2018-02-16T08:32:49.083949+00:00 app[web.1]: at Function.Module._load (module.js:491:3)
  143. 2018-02-16T08:32:49.083951+00:00 app[web.1]: at Function.Module.runMain (module.js:684:10)
  144. 2018-02-16T08:32:49.083952+00:00 app[web.1]: at startup (bootstrap_node.js:187:16)
  145. 2018-02-16T08:32:49.083954+00:00 app[web.1]: at bootstrap_node.js:608:3
  146. 2018-02-16T08:32:49.086111+00:00 app[web.1]: (node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Username contains an illegal unescaped character
  147. 2018-02-16T08:32:49.086216+00:00 app[web.1]: (node:20) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  148. 2018-02-16T08:32:49.681542+00:00 heroku[web.1]: State changed from starting to up
  149. 2018-02-16T08:34:01.000000+00:00 app[api]: Build started by user foo@gmail.com
  150. 2018-02-16T08:34:12.813906+00:00 heroku[web.1]: Restarting
  151. 2018-02-16T08:34:12.814458+00:00 heroku[web.1]: State changed from up to starting
  152. 2018-02-16T08:34:12.577577+00:00 app[api]: Release v34 created by user foo@gmail.com
  153. 2018-02-16T08:34:12.577577+00:00 app[api]: Deploy d3e91a9d by user foo@gmail.com
  154. 2018-02-16T08:34:01.000000+00:00 app[api]: Build succeeded
  155. 2018-02-16T08:34:13.936150+00:00 heroku[web.1]: Stopping all processes with SIGTERM
  156. 2018-02-16T08:34:14.047866+00:00 heroku[web.1]: Process exited with status 143
  157. 2018-02-16T08:34:16.448867+00:00 heroku[web.1]: Starting process with command `npm start`
  158. 2018-02-16T08:34:19.712447+00:00 app[web.1]:
  159. 2018-02-16T08:34:19.712477+00:00 app[web.1]: > react-deploy-test@1.0.0 start /app
  160. 2018-02-16T08:34:19.712479+00:00 app[web.1]: > node server.js
  161. 2018-02-16T08:34:19.712481+00:00 app[web.1]:
  162. 2018-02-16T08:34:20.739041+00:00 app[web.1]: Magic happens on port 13708
  163. 2018-02-16T08:34:20.859749+00:00 app[web.1]: DB connection alive
  164. 2018-02-16T08:34:20.860347+00:00 app[web.1]: mongo connected
  165. 2018-02-16T08:34:21.269185+00:00 heroku[web.1]: State changed from starting to up
  166. 2018-02-16T08:34:12.813906+00:00 heroku[web.1]: Restarting
  167. 2018-02-16T08:34:12.814458+00:00 heroku[web.1]: State changed from up to starting
  168. 2018-02-16T08:34:12.577577+00:00 app[api]: Release v34 created by user foo@gmail.com
  169. 2018-02-16T08:34:12.577577+00:00 app[api]: Deploy d3e91a9d by user foo@gmail.com
  170. 2018-02-16T08:34:01.000000+00:00 app[api]: Build succeeded
  171. 2018-02-16T08:34:13.936150+00:00 heroku[web.1]: Stopping all processes with SIGTERM
  172. 2018-02-16T08:34:14.047866+00:00 heroku[web.1]: Process exited with status 143
  173. 2018-02-16T08:34:16.448867+00:00 heroku[web.1]: Starting process with command `npm start`
  174. 2018-02-16T08:34:19.712447+00:00 app[web.1]:
  175. 2018-02-16T08:34:19.712477+00:00 app[web.1]: > react-deploy-test@1.0.0 start /app
  176. 2018-02-16T08:34:19.712479+00:00 app[web.1]: > node server.js
  177. 2018-02-16T08:34:19.712481+00:00 app[web.1]:
  178. 2018-02-16T08:34:20.739041+00:00 app[web.1]: Magic happens on port 13708
  179. 2018-02-16T08:34:20.859749+00:00 app[web.1]: DB connection alive
  180. 2018-02-16T08:34:20.860347+00:00 app[web.1]: mongo connected
  181. 2018-02-16T08:34:21.269185+00:00 heroku[web.1]: State changed from starting to up
Add Comment
Please, Sign In to add comment