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.

102 lines
2.7 KiB

6 years ago
6 years ago
  1. # NodeJSBlog
  2. This is a project I did to recreate my word press blog using plane node js. If I were to
  3. do this again, I would use PHP. NodeJS is great, however, it was a pain to deal
  4. with all the asynchronous calls when trying to create a web page in a linear fashion.
  5. If you want to run this project, it requires Mysql, npm, and node to be installed. For
  6. deployment I used a [Nginx](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04)
  7. proxy to expose the node application running on port 8000 to port 80. This proxy is necessary
  8. because you can't run a node application as port 80 unless you are root, which would be a
  9. security vulnerability.
  10. ## MYSQL Information
  11. ![](blogSql.svg)
  12. ```SQL
  13. create database jrtechs_blog;
  14. use jrtechs_blog;
  15. create table users(
  16. user_id mediumint unsigned not null AUTO_INCREMENT,
  17. user_name varchar(60) not null,
  18. password char(64) not null,
  19. salt char(64) not null,
  20. primary key(user_id)
  21. );
  22. create table categories(
  23. category_id mediumint unsigned not null AUTO_INCREMENT,
  24. name varchar(60) not null,
  25. url varchar(60) not null,
  26. primary key(category_id)
  27. );
  28. create table posts(
  29. post_id mediumint unsigned not null AUTO_INCREMENT,
  30. category_id mediumint unsigned not null,
  31. picture_url varchar(100) not null,
  32. published datetime not null,
  33. name varchar(100) not null,
  34. url varchar(100) not null,
  35. primary key(post_id)
  36. );
  37. create table downloads(
  38. download_id mediumint unsigned not null AUTO_INCREMENT,
  39. file varchar(40) not null,
  40. name varchar(40) not null,
  41. download_count mediumint not null,
  42. primary key(download_id)
  43. );
  44. create table popular_posts(
  45. popular_post_id mediumint unsigned not null AUTO_INCREMENT,
  46. post_id mediumint unsigned not null,
  47. primary key(popular_post_id)
  48. );
  49. grant all on jrtechs_blog.* to blog_user@localhost identified by "password";
  50. ```
  51. ## Node Dependencies
  52. ```bash
  53. npm install express
  54. npm install express-session
  55. npm install mysql
  56. npm install sanitizer
  57. npm install promise
  58. npm install highlight
  59. npm install crypto
  60. npm install remarkable
  61. npm install markdown
  62. npm install highlight.js
  63. npm install compression
  64. npm install memory-cache --save
  65. ```
  66. ## Color scheme
  67. [Adobe Color Wheel](https://color.adobe.com/create/color-wheel/?copy=true&base=2&rule=Custom&selected=3&name=Copy%20of%20Site&mode=rgb&rgbvalues=0.231,0.325499999999957,0.42,0,0.7450980392156863,0.6980392156862745,0.10196078431372549,0.36470588235294116,0.38823529411764707,0.8235294117647058,0.7529411764705882,1,0.3165071770335184,0.24148325358851674,0.49&swatchOrder=0,1,2,3,4)
  68. Blue:
  69. - Primary: #3B536B
  70. - Secondary: #00BEB2
  71. Purple:
  72. - Primary: #513E7D
  73. - Secondary: #D2C0FF
  74. Stuff for automated image compression
  75. ```
  76. apt-get install jpegoptim
  77. jpegoptim --size=500k *.jpg
  78. apt-get install optipng
  79. optipng *.png
  80. ```