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.
 
 
jrtechs 378b9a5484 Wrote most of the C++ code for the c to c++ tutorial blog post. 6 years ago
.idea Added a sitemap generator 6 years ago
admin Prevented server from caching admin page and started self hosting the font file. 6 years ago
css Updated the color scheme of website to match portfolio website and added purged the css file to make it smaller. 6 years ago
downloads Enabled Gzip compression through node dependency and updated script to compress and resize images down to 690px. 6 years ago
entries Wrote most of the C++ code for the c to c++ tutorial blog post. 6 years ago
img Finished Gremlin in 10 Minutes blog post 6 years ago
includes Started working on back end server analytics. 6 years ago
js Updated footer's copyright notice to not include a year. 6 years ago
posts Started working on back end server analytics. 6 years ago
sidebar Started working on back end server analytics. 6 years ago
utils Started working on back end server analytics. 6 years ago
LICENSE Updated License 6 years ago
README.md Started working on back end server analytics. 6 years ago
admin.js Created admin server and fixed code highlighting. 6 years ago
blogSql.svg Created export of diagram file 6 years ago
generateSitemap Started working on site map generator 6 years ago
optimizeImages.sh Created admin server and fixed code highlighting. 6 years ago
package.json Leveraged both client and server side caching. 6 years ago
robots.txt added meta stuff for google 6 years ago
run Created run script 6 years ago
server.js Wrote most of the C++ code for the c to c++ tutorial blog post. 6 years ago
sitemap.txt Started working on back end server analytics. 6 years ago

README.md

NodeJSBlog

This is a project I did to recreate my word press blog using plane node js. If I were to do this again, I would use PHP. NodeJS is great, however, it was a pain to deal with all the asynchronous calls when trying to create a web page in a linear fashion.

If you want to run this project, it requires Mysql, npm, and node to be installed. For deployment I used a Nginx proxy to expose the node application running on port 8000 to port 80. This proxy is necessary because you can't run a node application as port 80 unless you are root, which would be a security vulnerability.

Unless otherwise stated, everything in this repository can be assumed to fall under these two licenses depending on what type of file it is.

Code, scripts

All code, scripts, or other technical / programmatic items in this repo are assumed fall under the Mozilla Public License 2.0 unless otherwise stated.

Guides, articles, posts, misc. content

Creative Commons Attribution-ShareAlike 4.0 International License

All guides, scripts, posts, or otherwise non-programmatic content in this repo is assumed to fall under the Creative Commons Attribution-ShareAlike 4.0 International unless otherwise stated.

MYSQL Schema

create database jrtechs_blog;

use jrtechs_blog;

create table users(
user_id mediumint unsigned not null AUTO_INCREMENT,
user_name varchar(60) not null,
password char(64) not null,
salt char(64) not null,
primary key(user_id)
);

create table categories(
category_id mediumint unsigned not null AUTO_INCREMENT,
name varchar(60) not null,
url varchar(60) not null,
primary key(category_id)
);

create table posts(
post_id mediumint unsigned not null AUTO_INCREMENT,
category_id mediumint unsigned not null,
picture_url varchar(100) not null,
published datetime not null,
name varchar(100) not null,
url varchar(100) not null,
primary key(post_id)
);


create table downloads(
download_id mediumint unsigned not null AUTO_INCREMENT,
file varchar(40) not null,
name varchar(40) not null,
download_count mediumint not null,
primary key(download_id)
);

create table popular_posts(
popular_post_id mediumint unsigned not null AUTO_INCREMENT,
post_id mediumint unsigned not null,
primary key(popular_post_id)
);

create table traffic_log(
log_id mediumint unsigned not null AUTO_INCREMENT,
url varchar(60) not null,
ip varchar(20) not null,
date datetime not null,
primary key(log_id)
);


grant all on jrtechs_blog.* to blog_user@localhost identified by "password";

Node Dependencies

npm install express
npm install express-session
npm install mysql
npm install sanitizer
npm install promise
npm install highlight
npm install crypto
npm install remarkable
npm install markdown
npm install highlight.js
npm install compression
npm install memory-cache --save

Color scheme

The color scheme has been changing a lot recently.

Adobe Color Wheel

current: top 2C3E50 secondary 498FBE highlight:00F0E1, 88BAFF

Image Optimization

Stuff for automated image compression

apt-get install jpegoptim
apt-get install optipng

./optimizeImages.sh

NGINX Configuration

#jrtechs.net.conf
server {
    listen 80;
    server_name www.jrtechs.net jrtechs.net;

    # redirect http requests to https
    return 301 https://jrtechs.net$request_uri;
}

server {
    listen 443 ssl http2;

    server_name jrtechs.net;

    ssl_certificate /etc/letsencrypt/live/jrtechs.net/cert.pem;
    ssl_certificate_key /etc/letsencrypt/live/jrtechs.net/privkey.pem;

    location / {
        proxy_pass http://localhost:8000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}


#admin.jrtechs.net.con
server {
    listen 80;
    server_name www.admin.jrtechs.net admin.jrtechs.net;

    # redirect http requests to https
    return 301 https://admin.jrtechs.net$request_uri;
}

server {
    listen 443 ssl http2;

    server_name admin.jrtechs.net;

    ssl_certificate /etc/letsencrypt/live/admin.jrtechs.net/cert.pem;
    ssl_certificate_key /etc/letsencrypt/live/admin.jrtechs.net/privkey.pem;

    location / {
        proxy_pass http://localhost:8001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}