はじめに 本投稿で使用している環境 Node.js: 20.5.1 @nestjs/core: 10.1.3 (platformにはfastifyを使用) prisma: 5.7.0 @prisma/client: 5.7.0 Prisma Transactionの種類 PrismaでTransactionを実行する場合は大きく分けて以下の2つの書き方があります。 1. Nested writes 1発のPrismaClient操作で、リレーションのレコードも含めて操作する書き方です。 const newUser: User = await prisma.user.create({ data: { email: 'alice@prisma.io', posts: { create: [ { title: 'Join the Prisma Slack on https://slack.pri
NestJSとJWT認証で調べて出てくるのは、JWTを自分たちで発行しているやつが多く、Cognitoなど外部がトークン発行してくれる系の認証サンプルが少なかったので、共有します。 公式サイトでは認証に関するページは以下のリンクです。 目標 以下のようにappコントローラーにjwt認証を追加します。このコントローラーにリクエストを送っても、有効なJWTをAuthenticationヘッダに付与しなければ、401エラーで弾かれる仕様です。 @UseGuards(JwtGuard) @Controller() export class AppController { @Get('hello') testGet(): string { return 'Hello!'; } }
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く