Skip to content

MatasJurev/blog-app-demo-nodejs-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Blog app demo

This is a sample project - simple blog website built with React and nodejs.

Prerequisites

nodejs, mysql server, npm package manager or something alternative like yarn

Quick start

Disclaimer: front-end application should work without back-end application.

First, mysql needs to be setup like this:

schema: blog

tables:

CREATE TABLE `posts` (
  `id` int NOT NULL,
  `title` varchar(255) NOT NULL,
  `desc` longtext NOT NULL,
  `img` varchar(255) DEFAULT NULL,
  `date` datetime NOT NULL,
  `uid` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `uid_idx` (`uid`),
  CONSTRAINT `uid` FOREIGN KEY (`uid`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `stock_data` (
  `date` datetime NOT NULL,
  `open` varchar(45) NOT NULL,
  `high` varchar(45) NOT NULL,
  `low` varchar(45) NOT NULL,
  `close` varchar(45) NOT NULL,
  `volume` varchar(45) NOT NULL,
  PRIMARY KEY (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(45) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `img` varchar(511) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

Then, in api folder .env text file needs to be created to store these environment variables:

DB_HOST - database url adress, DB_USER - database user, DB_PASSWORD - database password, DB_NAME - schema name(blog), ALPHA_API_KEY - api key from https://www.alphavantage.co/

Back-end application is stored in "api" folder and front-end application is in "client" folder. In each of these directories, the following commands need to be executed: npm install and npm start.

And this is it.

Screenshots

image

image

image

image

image

image

image

image

image

image

image

image

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published