Nestjs学习笔记

mysql 的安装信息

C:\Users\kitety>mysqld –initialize –console
2021-12-31T13:48:46.173370Z 0 [System] [MY-013169] [Server] D:\fav\mysql-8.0.27-winx64\bin\mysqld.exe (mysqld 8.0.27) initializing of server in progress as process 8884
2021-12-31T13:48:46.352720Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-31T13:48:52.446815Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-12-31T13:49:10.994404Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-12-31T13:49:10.994556Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-12-31T13:49:11.166673Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: CktOrXq9ru&w

输入net start mysql或sc start mysql

启动mysql服务

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;

Untitled

Untitled

Untitled

Untitled

nest generate controller messages/messages –flat 不会产生新的文件夹

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

执行的时候都会变为js,那么类型就不存在了。那这是怎么做到的呢?

所以并不是所有的ts都不会被编译到js里面

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

后面发现需要的话就会重用实例

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

database

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

user resource

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

save和remove就是为instance设计的

更新的逻辑,效率有点低

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

大项目

Untitled

小项目

Untitled

以后的发展

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

https://www.notion.so

Untitled

Untitled

Untitled

Untitled

因此需要创建拦截器

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

https://www.notion.so

Untitled

Untitled

e2e测试跳过了main.ts file

换成下面的这种

Untitled

以便让e2e运行pipe和cookie-session

Untitled

Untitled

多数据库

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

需要注意并行运行e2e测试,并行访问sqlite文件会报错,因此改为串行--maxWorkers=1

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

onetomany 数据库没有改变,Manytone,数据库有改变

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

验证和授权

Untitled

Untitled

需要转换为middleware

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

Untitled

typeorm cli中不能获取到connection options

Untitled

  • 没有能力读取json、yml格式的文件
  • 不应该用ts,因为直接运行的是js,其实现在已经可以了
  • 不能利用环境变量来设置类型

Untitled

Untitled

Untitled

测试的时候使用这个执行的,会报错

Untitled

Untitled

dev—js

test—ts

Untitled

Untitled

Untitled

Untitled

npm install -g ts-node

https://orkhan.gitbook.io/typeorm/docs/using-cli

To create a new empty migration use “typeorm migration:create” command

Untitled

Untitled

heroku create

https://secure-garden-44648.herokuapp.com/ | https://git.heroku.com/secure-garden-44648.git

heroku addons: create heroku-postgresql:hobby-dev

Creating heroku-postgresql:hobby-dev on ⬢ secure-garden-44648… free
Database has been created and is available
! This database is empty. If upgrading, you can transfer
! data from another database with pg:copy
Created postgresql-flat-19586 as DATABASE_URL
Use heroku addons:docs heroku-postgresql to view documentation

heroku config:set COOKIE_KEY=1k23412k3j4

heroku config:set NODE_ENV=production

git push heroku master

使用搜索:谷歌必应百度