Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.59 KB | None | 0 0
  1. var express = require('express');
  2. var path = require('path');
  3. var favicon = require('serve-favicon');
  4. var logger = require('morgan');
  5. var cookieParser = require('cookie-parser');
  6. var bodyParser = require('body-parser');
  7. var index = require('./routes/index');
  8. var socket = require('./common/socket');
  9. var exphbs = require('express-handlebars');
  10. var app = express();
  11. require('node-jsx').install();
  12.  
  13. var port = process.env.PORT || 9091;
  14. var io = require('socket.io').listen(app.listen(port, function(){
  15. console.log('Server is listening on port: ' + port);
  16. }));
  17.  
  18. io.sockets.on('connection', function(sock){
  19. socket(sock , io);
  20. });
  21.  
  22. io.configure(function () {
  23. io.set("transports", ["xhr-polling"]);
  24. io.set("polling duration", 10);
  25. });
  26.  
  27. // view engine setup
  28. app.engine('handlebars', exphbs({defaultLayout: 'main', extname: '.handlebars'}));
  29. app.set('views', path.join(__dirname, 'views'));
  30. app.set('view engine', 'handlebars');
  31.  
  32.  
  33. // uncomment after placing your favicon in /public
  34. //app.use(favicon(__dirname + '/public/favicon.ico'));
  35. app.use(logger('dev'));
  36. app.use(bodyParser.json());
  37. app.use(bodyParser.urlencoded({ extended: false }));
  38. app.use(cookieParser());
  39. app.use(express.static(path.join(__dirname, 'public')));
  40.  
  41.  
  42. app.use('/', index);
  43.  
  44. // catch 404 and forward to error handler
  45. app.use(function(req, res, next) {
  46. var err = new Error('Not Found');
  47. err.status = 404;
  48. next(err);
  49. });
  50.  
  51. // error handlers
  52.  
  53. // development error handler
  54. // will print stacktrace
  55. if (app.get('env') === 'development') {
  56. app.use(function(err, req, res, next) {
  57. res.status(err.status || 500);
  58. console.log(err.message);
  59. res.render('error', {
  60. message: err.message,
  61. error: err
  62. });
  63. });
  64. }
  65.  
  66. // production error handler
  67. // no stacktraces leaked to user
  68. app.use(function(err, req, res, next) {
  69. res.status(err.status || 500);
  70. res.render('error', {
  71. message: err.message,
  72. error: {}
  73. });
  74. });
  75.  
  76.  
  77. module.exports = app;
  78.  
  79. 'use strict';
  80. var React = require('react');
  81. var io = require('socket.io-client');
  82. var socket;
  83. var UserRow = require('./userRow');
  84. var SimpleUserList = React.createClass({
  85.  
  86. displayName: 'SimpleUserList',
  87.  
  88. componentDidMount: function() {
  89. socket = io.connect();
  90. socket.on('userList', function(data) {
  91. console.log('userlist received');
  92. }.bind(this));
  93.  
  94. },
  95.  
  96. componentWillUnmount: function() {
  97. socket.close();
  98. },
  99. render: function() {
  100. return (<div></div>);
  101. }
  102. module.exports = SimpleUserList;
  103.  
  104. <!doctype html>
  105. <html lang="en">
  106. <head>
  107. <meta charset="utf-8">
  108. <meta name="viewport" content="width=device-width, initial-scale=1">
  109. <link rel="stylesheet" type="text/css" href="stylesheets/style.css">
  110. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  111. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  112. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  113.  
  114. </head>
  115. <body>
  116. {{{ body }}}
  117. <script src="https://cdn.socket.io/socket.io-1.0.0.js"></script>
  118. <script src="javascripts/bundle.js"></script>
  119. </body>
  120. </html>
  121.  
  122. 2015-07-29T10:59:30.153481+00:00 app[web.1]: > npm run-script build | node server.js
  123. 2015-07-29T10:59:30.153482+00:00 app[web.1]:
  124. 2015-07-29T10:59:39.356552+00:00 app[web.1]: /app/server.js:22
  125. 2015-07-29T10:59:39.356556+00:00 app[web.1]: io.configure(function () {
  126. 2015-07-29T10:59:39.356558+00:00 app[web.1]: ^
  127. 2015-07-29T10:59:39.356560+00:00 app[web.1]: TypeError: undefined is not a function
  128. 2015-07-29T10:59:39.356561+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:22:4)
  129. 2015-07-29T10:59:39.356565+00:00 app[web.1]: at Object.Module._extensions..js (module.js:478:10)
  130. 2015-07-29T10:59:39.356590+00:00 app[web.1]: at Module.load (module.js:355:32)
  131. 2015-07-29T10:59:39.356595+00:00 app[web.1]: at startup (node.js:129:16)
  132. 2015-07-29T10:59:39.356563+00:00 app[web.1]: at Module._compile (module.js:460:26)
  133. 2015-07-29T10:59:39.356593+00:00 app[web.1]: at Function.Module.runMain (module.js:501:10)
  134. 2015-07-29T10:59:39.356596+00:00 app[web.1]: at node.js:814:3
  135. 2015-07-29T10:59:39.356592+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
  136. 2015-07-29T10:59:44.937645+00:00 app[web.1]: npm ERR! Linux 3.13.0-49-generic
  137. 2015-07-29T10:59:44.817354+00:00 app[web.1]: util.print: Use console.log instead
  138. 2015-07-29T10:59:44.932214+00:00 app[web.1]:
  139. 2015-07-29T10:59:44.938157+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
  140. 2015-07-29T10:59:44.938399+00:00 app[web.1]: npm ERR! node v0.12.7
  141. 2015-07-29T10:59:44.938826+00:00 app[web.1]: npm ERR! npm v2.11.3
  142. 2015-07-29T10:59:44.939022+00:00 app[web.1]: npm ERR! code ELIFECYCLE
  143. 2015-07-29T10:59:44.939233+00:00 app[web.1]: npm ERR! simple-user-list@0.0.0 start: `npm run-script build | node server.js `
  144. 2015-07-29T10:59:44.939499+00:00 app[web.1]: npm ERR! Exit status 1
  145. 2015-07-29T10:59:44.939661+00:00 app[web.1]: npm ERR!
  146. 2015-07-29T10:59:44.939844+00:00 app[web.1]: npm ERR! Failed at the simple-user-list@0.0.0 start script 'npm run-script build | node server.js '.
  147. 2015-07-29T10:59:44.940270+00:00 app[web.1]: npm ERR! This is most likely a problem with the simple-user-list package,
  148. 2015-07-29T10:59:44.940497+00:00 app[web.1]: npm ERR! not with npm itself.
  149. 2015-07-29T10:59:44.940649+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
  150. 2015-07-29T10:59:44.940834+00:00 app[web.1]: npm ERR! npm run-script build | node server.js
  151. 2015-07-29T10:59:44.940988+00:00 app[web.1]: npm ERR! You can get their info via:
  152. 2015-07-29T10:59:44.941492+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
  153. 2015-07-29T10:59:44.944584+00:00 app[web.1]:
  154. 2015-07-29T10:59:44.941149+00:00 app[web.1]: npm ERR! npm owner ls simple-user-list
  155. 2015-07-29T10:59:44.944830+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
  156. 2015-07-29T10:59:44.944952+00:00 app[web.1]: npm ERR! /app/npm-debug.log
  157. 2015-07-29T10:59:45.817817+00:00 heroku[web.1]: Process exited with status 1
  158. 2015-07-29T10:59:45.831953+00:00 heroku[web.1]: State changed from starting to crashed
  159. 2015-07-29T10:59:47.593870+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=bd0cf3d6-0b8b-4fc0-aa37-a940cd5f328f fwd="50.19.169.132" dyno= connect= service= status=503 bytes=
  160. 2015-07-29T10:59:57.607136+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=8f80ec43-0eb8-4375-9341-7c1c2ecb81f0 fwd="50.19.169.132" dyno= connect= service= status=503 bytes=
  161. 2015-07-29T11:00:07.626517+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=4ee95d7b-e757-4590-b9e9-f48f491a3654 fwd="50.19.169.132" dyno= connect= service= status=503 bytes=
  162. 2015-07-29T11:00:17.650806+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=bdebebe0-6b5b-444b-81f2-fb34d3b00bb4 fwd="50.19.169.132" dyno= connect= service= status=503 bytes=
  163. 2015-07-29T11:00:27.660163+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=289949c3-1dac-4f3c-bb89-f6093da2c997 fwd="50.19.169.132" dyno= connect= service= status=503 bytes=
  164. 2015-07-29T11:00:37.669828+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=997d267f-81fb-40e4-9c7d-85f9803653f8 fwd="50.19.169.132" dyno= connect= service= status=503 bytes=
  165. 2015-07-29T11:06:28.718078+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=simple-user-list.herokuapp.com request_id=c0f10a34-914a-439b-8a59-5ef954d994e8 fwd="207.6.39.42" dyno= connect= service= status=503 bytes=
  166. 2015-07-29T11:10:46.273821+00:00 heroku[web.1]: State changed from crashed to starting
  167. 2015-07-29T11:10:49.577787+00:00 heroku[web.1]: Starting process with command `npm start`
  168. 2015-07-29T11:10:51.591809+00:00 app[web.1]:
  169. 2015-07-29T11:10:51.591830+00:00 app[web.1]: > simple-user-list@0.0.0 start /app
  170. 2015-07-29T11:10:51.591832+00:00 app[web.1]: > npm run-script build | node server.js
  171. 2015-07-29T11:10:51.591833+00:00 app[web.1]:
  172. 2015-07-29T11:10:57.340680+00:00 app[web.1]: /app/server.js:22
  173. 2015-07-29T11:10:57.340683+00:00 app[web.1]: io.configure(function () {
  174. 2015-07-29T11:10:57.340685+00:00 app[web.1]: ^
  175. 2015-07-29T11:10:57.340687+00:00 app[web.1]: TypeError: undefined is not a function
  176. 2015-07-29T11:10:57.340689+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:22:4)
  177. 2015-07-29T11:10:57.340692+00:00 app[web.1]: at Object.Module._extensions..js (module.js:478:10)
  178. 2015-07-29T11:10:57.340693+00:00 app[web.1]: at Module.load (module.js:355:32)
  179. 2015-07-29T11:10:57.340690+00:00 app[web.1]: at Module._compile (module.js:460:26)
  180. 2015-07-29T11:10:57.340695+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
  181. 2015-07-29T11:10:57.340696+00:00 app[web.1]: at Function.Module.runMain (module.js:501:10)
  182. 2015-07-29T11:10:57.340697+00:00 app[web.1]: at startup (node.js:129:16)
  183. 2015-07-29T11:10:57.340699+00:00 app[web.1]: at node.js:814:3
  184. 2015-07-29T11:11:02.957215+00:00 app[web.1]: util.print: Use console.log instead
  185. 2015-07-29T11:11:03.080961+00:00 app[web.1]: npm ERR! Linux 3.13.0-57-generic
  186. 2015-07-29T11:11:03.088435+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
  187. 2015-07-29T11:11:03.088566+00:00 app[web.1]: npm ERR! /app/npm-debug.log
  188. 2015-07-29T11:11:03.074299+00:00 app[web.1]:
  189. 2015-07-29T11:11:03.081974+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
  190. 2015-07-29T11:11:03.082248+00:00 app[web.1]: npm ERR! node v0.12.7
  191. 2015-07-29T11:11:03.082698+00:00 app[web.1]: npm ERR! npm v2.11.3
  192. 2015-07-29T11:11:03.082883+00:00 app[web.1]: npm ERR! code ELIFECYCLE
  193. 2015-07-29T11:11:03.083205+00:00 app[web.1]: npm ERR! simple-user-list@0.0.0 start: `npm run-script build | node server.js `
  194. 2015-07-29T11:11:03.083354+00:00 app[web.1]: npm ERR! Exit status 1
  195. 2015-07-29T11:11:03.083515+00:00 app[web.1]: npm ERR!
  196. 2015-07-29T11:11:03.083669+00:00 app[web.1]: npm ERR! Failed at the simple-user-list@0.0.0 start script 'npm run-script build | node server.js '.
  197. 2015-07-29T11:11:03.084247+00:00 app[web.1]: npm ERR! not with npm itself.
  198. 2015-07-29T11:11:03.084376+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
  199. 2015-07-29T11:11:03.083969+00:00 app[web.1]: npm ERR! This is most likely a problem with the simple-user-list package,
  200. 2015-07-29T11:11:03.085055+00:00 app[web.1]: npm ERR! You can get their info via:
  201. 2015-07-29T11:11:03.084565+00:00 app[web.1]: npm ERR! npm run-script build | node server.js
  202. 2015-07-29T11:11:03.085058+00:00 app[web.1]: npm ERR! npm owner ls simple-user-list
  203. 2015-07-29T11:11:03.085128+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
  204. 2015-07-29T11:11:03.088091+00:00 app[web.1]:
  205. 2015-07-29T11:11:03.853402+00:00 heroku[web.1]: Process exited with status 1
  206. 2015-07-29T11:11:03.866414+00:00 heroku[web.1]: State changed from starting to crashed
  207. 2015-07-29T11:16:15.196180+00:00 heroku[slug-compiler]: Slug compilation started
  208. 2015-07-29T11:16:15.196195+00:00 heroku[slug-compiler]: Slug compilation finished
  209. 2015-07-29T11:16:15.153339+00:00 heroku[api]: Deploy a6fb15c by aryan.hosseinzadeh@gmail.com
  210. 2015-07-29T11:16:15.153339+00:00 heroku[api]: Release v15 created by aryan.hosseinzadeh@gmail.com
  211. 2015-07-29T11:16:15.571381+00:00 heroku[web.1]: State changed from crashed to starting
  212. 2015-07-29T11:16:19.908038+00:00 heroku[web.1]: Starting process with command `npm start`
  213. 2015-07-29T11:16:22.344144+00:00 app[web.1]:
  214. 2015-07-29T11:16:22.344166+00:00 app[web.1]: > simple-user-list@0.0.0 start /app
  215. 2015-07-29T11:16:22.344168+00:00 app[web.1]: > npm run-script build | node server.js
  216. 2015-07-29T11:16:22.344170+00:00 app[web.1]:
  217. 2015-07-29T11:16:28.997464+00:00 app[web.1]: Option polling duration is not valid. Please refer to the README.
  218. 2015-07-29T11:16:29.378774+00:00 heroku[web.1]: State changed from starting to up
  219. 2015-07-29T11:16:29.671752+00:00 app[web.1]: Server is listening on port: 9807
  220. 2015-07-29T11:16:30.880399+00:00 heroku[router]: at=info method=GET path="/" host=simple-user-list.herokuapp.com request_id=8286e365-9790-487e-9b71-a69a4de800fc fwd="54.144.80.213" dyno=web.1 connect=6ms service=227ms status=200 bytes=2017
  221. 2015-07-29T11:16:30.910262+00:00 app[web.1]: GET / 200 252.009 ms - 1821
  222. 2015-07-29T11:16:34.120554+00:00 app[web.1]: util.print: Use console.log instead
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement