Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wayou/node-crud
Node.js + Koa + MySQL CRUD example
https://github.com/wayou/node-crud
crud koa mysql node
Last synced: 3 months ago
JSON representation
Node.js + Koa + MySQL CRUD example
- Host: GitHub
- URL: https://github.com/wayou/node-crud
- Owner: wayou
- Created: 2019-04-26T13:57:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T19:51:38.000Z (over 3 years ago)
- Last Synced: 2024-04-14T20:08:36.537Z (9 months ago)
- Topics: crud, koa, mysql, node
- Language: JavaScript
- Homepage:
- Size: 229 KB
- Stars: 5
- Watchers: 3
- Forks: 5
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# koa + mysql todo app
sample project to demonstrate the crud operations.
## prerequirments
you need mysql installed and setup a appropriate user to run the demo.
### mysql quick reference
installing:
```sh
$ brew install mysql
```start mysql service:
```sh
$ brew services start mysql
```login as root and add a user:
```sh
$ mysql -uroot
mysql> create user ''@'localhost' identified with mysql_native_password by ''
```then fill the `` and `pswd` into [config.js](./config.js)
login as the new created user and create corresponding database and tables.
```sh
mysql> quit
$ mysql -u -p
Enter password: ***
mysql> create database todo
mysql> use todo;
```execute the following script to create the todo table:
```sh
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
```## installing
```sh
$ yarn
```## running
```sh
$ yarn start
server started at http://localhost:3000
```then visit [http://localhost:3000](http://localhost:3000).