sample project to demonstrate the crud operations.
you need mysql installed and setup a appropriate user to run the demo.
installing:
$ brew install mysql
start mysql service:
$ brew services start mysql
login as root and add a user:
$ mysql -uroot
mysql> create user '<username>'@'localhost' identified with mysql_native_password by '<pswd>'
then fill the <username>
and pswd
into config.js
login as the new created user and create corresponding database and tables.
mysql> quit
$ mysql -u <username> -p
Enter password: ***
mysql> create database todo
mysql> use todo;
execute the following script to create the todo table:
CREATE TABLE `todo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`content` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL,
`is_done` int(11) DEFAULT '0',
`date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
$ yarn
$ yarn start
server started at http://localhost:3000
then visit http://localhost:3000.