Using MySQL in Node & Express to build Simple CRUD App ( Blog )
npm install
copy
.env.example
to.env
and Add your DB configuration.
Authors Table:
CREATE TABLE `authors` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)
);
Posts Table:
CREATE TABLE `posts` (
`id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`summary` VARCHAR(255) NOT NULL,
`body` TEXT NOT NULL,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`author_id` INT NOT NULL,
PRIMARY KEY (`id`)
);
npm start
npm run format
npm run lint