git clone https://github.com/baron-todo-app/server
cd server
git submodule update --init --recursive
# db のみ起動 して nodeはローカルで dockerのホットリロードが遅いため
docker-compose up --build -d app_db; docker-compose ps
# npm
yarn
# マイグレーション 実行
yarn ts-node $(npm bin)/typeorm migration:run
# DB ドキュメント
docker-compose up app_db schemaspy
# schemaspy_local exited with code 0
# ctrl + c
yarn http-server doc/schemaspy
# コードドキュメント
yarn compodoc -p tsconfig.json -d doc/compodoc
yarn http-server doc/compodoc -p 8081
# test
yarn test:cov
yarn http-server doc/coverage/lcov-report -p 8082
# 起動
yarn start:dev
# GQL
# http://localhost:5000/voyager
# http://localhost:5000/graphql
# DB
# http://127.0.0.1:8080
# コードドキュメント
# http://127.0.0.1:8081
# カバレッジ
# http://127.0.0.1:8082
# db のみ起動 して nodeはローカルで dockerのホットリロードが遅いため
docker-compose up --build -d app_db; docker-compose ps
# 起動
yarn start:dev
mysql -uroot -p -h 127.0.0.1
# DB関連の操作不可 -> つまり mockにする
# nestjsの思想, unit testの思想
yarn test
xxx.entity.ts でモデル定義
# マイグレーションファイル作成
yarn ts-node $(npm bin)/typeorm migration:generate -n Initialize
# マイグレーション 実行
yarn ts-node $(npm bin)/typeorm migration:run
# マイグレーション 戻し
yarn ts-node $(npm bin)/typeorm migration:revert
# マイグレーション 実行
yarn ts-node $(npm bin)/typeorm migration:run
xxx.entity.ts でモデル更新
# これを育てる
typeorm migration:create -n Xxx
https://github.com/typeorm/typeorm/blob/master/docs/migrations.md
他に方法無し...
たぶん、今のとこはない 追加予定らしい
ALTER TABLE xxx COMMENT 'タスクを管理'
query {
foo: getTasks(FreeWord: {txt: ""}) {
id
title
body
}
}
query {
cc: getTask(GetTask: {id: 1}) {
id
title
}
}
mutation {
addTask(AddTask: {title: "aaa" body: "bbb"}) {
id
title
body
}
}
mutation {
updateTask(
UpdateTask:{
id: 1
title: "aaa"
body: "bbb"
}) {
id
}
}
mutation {
deleteTask(DeleteTask:{id: 1}) {
id
title
}
}
# 初期
docker pull mysql:5.7.24
docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=mysql -e MYSQL_DATABASE=task -p 3306:3306 mysql:5.7.24 --character-set-server=utf8 --collation-server=utf8_unicode_ci
# 開始
docker start mysql
# 停止
docker stop mysql
# 対話形式
docker exec -it mysql bash
mysql -uroot -p
mysql
insert into task.todo (title, body) values ("aaa", "abcd efg");
insert into task.todo (title, body) values ("aaa", "100%");
insert into task.todo (title, body) values ("bbb", "0% % _");
insert into task.todo (title, body) values ("bbb", "hoge fuga");
insert into task.todo (title, body) values ("bbb", "100% 200% 300%");
insert into task.todo (title, body) values ("bbb", "__ abc efg");
insert into task.todo (title, body) values ("bbb", "\\");
select * from task.todo;
delete from task.todo; select * from task.todo;
drop database task; create database task;
-
- GQL関連全体像
-
- GQLプレイグラウンド
- mysql
- docker-compose up app_db schemaspy
- compodoc
- yarn compodoc -p tsconfig.json -d doc/compodoc
- yarn compodoc -p tsconfig.json -s # サーバ起動
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
Nest framework TypeScript starter repository.
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.