Giter Club home page Giter Club logo

learn-nestjs's Introduction

learn-nestjs

概要

  • NestJS
  • TypeORM

Docker起動

$ docker compose up -d

止める場合は以下。

$ docker compose stop

GraphQL

http://localhost:3000/graphql

Typeorm

エンティティの作成

$ yarn typeorm entity:create ./src/entities/{Entitiy Name}

マイグレーションの作成

$ yarn typeorm migration:generate -d src/data-source.ts src/migrations/{Migration Name}

マイグレーションを実行

$ yarn typeorm migration:run -d src/data-source.ts

curlによる動作確認

curl pathで実行。 -X でhttpリクエストを指定する。

# 例)
# タスクを登録
$ curl http://localhost:3000/task -X POST -d "title=ジムに行く&due_date=2021-10-05"
# タスクを取得
$ curl http://localhost:3000/hoge -X GET

Prismaについて

状況

中途半端に導入してしまったが、うまく動かないので、実際にはTypeORMが動き続けている。 Prismaに関しては気にしないようにしてほしい。

データベースに権限をつける必要がある

管理者(たぶんroot/password)でログインして、以下を実行する。

CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
GRANT CREATE, ALTER, DROP ON *.* TO 'user'@'%';
FLUSH PRIVILEGES;

userpassword は任意の値でOK

learn-nestjs's People

Contributors

taako-502 avatar dependabot[bot] avatar

Stargazers

hiroaki-com avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.