Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. /node
  2. . /config
  3. . default.js
  4. . node_modules
  5. . /controllers
  6. . myfile.js
  7. . other files
  8. . app.js
  9.  
  10. const express = require('express');
  11. const app = express();
  12. const mysql = require('mysql');
  13. const path = require('path');
  14. const config = require('config');
  15. const bodyParser = require('body-parser');
  16. const moment = require('moment');
  17. app.use(bodyParser.json({type: '*/*'}));
  18. var client;
  19. const redis = require("redis");
  20. client = redis.createClient();
  21.  
  22. client.on("error", function (err) {
  23. console.log("Error " + err);
  24. });
  25.  
  26. const connectionPool = mysql.createPool({
  27. host: config.get('database.host'),
  28. user: config.get('database.user'),
  29. password: config.get('database.password'),
  30. database: config.get('database.dbname'),
  31. connectionLimit: 2
  32. });
  33.  
  34. function selectUpdatedData() {
  35.  
  36. connectionPool.query("SELECT * FROM rc_devices_notifications", function (err, rows, fields) {
  37. //DO STUFF
  38. process.exit();
  39. });
  40. }
  41.  
  42. selectUpdatedData();
  43.  
  44. WARNING: No configurations found in configuration directory:/home/rc-user/node/controllers/config
  45. WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
  46. /home/rc-user/node/node_modules/config/lib/config.js:181
  47. throw new Error('Configuration property "' + property + '" is not defined');
  48. ^
  49.  
  50. Error: Configuration property "database.host" is not defined
  51. at Config.get (/home/rc-user/node/node_modules/config/lib/config.js:181:11)
  52. at Object.<anonymous> (/home/rc-user/node/controllers/update_trackers.js:20:18)
  53. at Module._compile (module.js:573:32)
  54. at Object.Module._extensions..js (module.js:582:10)
  55. at Module.load (module.js:490:32)
  56. at tryModuleLoad (module.js:449:12)
  57. at Function.Module._load (module.js:441:3)
  58. at Module.runMain (module.js:607:10)
  59. at run (bootstrap_node.js:420:7)
  60. at startup (bootstrap_node.js:139:9)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement