$project
├── README.md
├── admin
├── blog
└── service
First create database 'react-blog' using mysql:
create table admin_user
(
username varchar(50) null,
password varchar(50) null,
id int auto_increment
primary key
);
create table type
(
id int auto_increment
primary key,
type_name varchar(50) null,
`order` int null
);
create table article
(
id int auto_increment
primary key,
type_id int not null,
title varchar(100) null,
content text null,
introduction text null,
create_time datetime null,
view_count int null,
constraint article_type_null_fk
foreign key (type_id) references type (id)
)
CREATE TABLE `file` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL COMMENT '文件名',
`md5` varchar(32) DEFAULT NULL COMMENT 'MD5值',
`path` varchar(100) NOT NULL COMMENT '文件路径',
`upload_time` datetime(3) NOT NULL COMMENT '上传时间',
`ext` varchar(255) DEFAULT NULL COMMENT '文件后缀名',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
cd $project/service
npm install
npm run start
cd $project/admin
npm install
npm run start
cd $project/blog
npm install
npm run start
list articles:
add article:
home page list:
markdown display: