Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.3 KiB

  1. const Promise = require('promise');
  2. const sql = require('../utils/sql');
  3. module.exports=
  4. {
  5. /**
  6. * Responsible for querying the database and displaying all
  7. * categories that the blog has in the sidebar
  8. *
  9. * @param res
  10. * @return {*|Promise}
  11. */
  12. main: function(res)
  13. {
  14. return new Promise(function(resolve, reject)
  15. {
  16. res.write("<div class=\"w3-col l4\">");
  17. sql.getCategories().then(function(categories)
  18. {
  19. console.log(categories[0].name);
  20. console.log("cool beans");
  21. // for(var category in categories)
  22. // {
  23. // console.log(category);
  24. // res.write(category.name);
  25. // }
  26. res.write("</div>");
  27. resolve();
  28. })
  29. });
  30. }
  31. };
  32. /*
  33. <!-- Labels / tags -->
  34. <div class="w3-card w3-margin">
  35. <div class="w3-container w3-padding">
  36. <h4>Tags</h4>
  37. </div>
  38. <div class="w3-container w3-white">
  39. <p><span class="w3-tag w3-black w3-margin-bottom">Travel</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">New York</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">London</span>
  40. <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">IKEA</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">NORWAY</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">DIY</span>
  41. <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Ideas</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Baby</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Family</span>
  42. <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">News</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Clothing</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Shopping</span>
  43. <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Sports</span> <span class="w3-tag w3-light-grey w3-small w3-margin-bottom">Games</span>
  44. </p>
  45. </div>
  46. </div>
  47. */