A tech blog prototype that can be easily extended. As of now it has a basic authentication functionality that allows a user to either login or sign up. A registered user that's logged in has elevated access to add blog posts and comments.
The structure of the codebase follows MVC design pattern. Additionally it relies on the following frameworks and libraries: MySQL RDBMS, Sequelize to decouple from backend and Express that handles HTTP requests, Handlebars to render HTML templates.
NOTE: Make sure you have
Node.JS ~v16.14.2andNPM ~8.11.0installed. You can quickly check this by runningnode -vfor Node.JS andnpm -vfor NPM in your terminal. Additionally it requiresmysql ~8.0.29
Once the above is confirmed, clone the repo git clone git@github.com:rkutsel/js-tech-blog.git and install the dependencies by running npm i in your terminal. I recommend you install them locally. A successful installation should look somewhat similar to the one bellow:
added 224 packages, and audited 371 packages in 1s
74 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilitiesRename .env.EXAMPLE to .env. Open the .env file and change the variables as needed.
./db directory has schema.sql that needs to be imported into your MySQL. Note: this set up is not meant to be run in production. Seeding is also available if you need some initial data to get started quickly.
# from the root directory run:
mysql -u root -p < db/schema.sql
node seeds/seed.js # NOTE: this is optional and should only be run if you need some initial data. To get started, form the root directory run node server or npm start dev which should fire up all of the components. Optionally you can run npm run watch that would provide you with a better dev experience. At this point you should be able to consume the API. You can use any API client.
The functionality is provided out of the box. There's a few additonal steps required in order to make it work with heroku upon deploy. This guide Deploy With Heroku And MySQL has a detailed walk-through on how to acheive that.