-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
tags: | ||
- posts | ||
- rpc | ||
- hono | ||
- cors | ||
--- | ||
honoで`hono/client`を利用したRPCモードでのクライアント通信を実装していたところ、CORS対応にて調べた内容。 | ||
|
||
#### hono: CORS設定 | ||
|
||
> https://hono.dev/docs/middleware/builtin/cors | ||
```ts | ||
const authClient = hc<SomeType>("/api/auth/", { | ||
headers: {} // You can already set headers! | ||
credentials: "include", | ||
}); | ||
``` | ||
|
||
その場合のclientでは`init: {}`にてcredentials設定を行う。 | ||
|
||
```ts | ||
const api = hc('api/auth', { | ||
init: { | ||
credentials: 'include', | ||
}, | ||
}) | ||
``` | ||
|
||
> https://github.com/orgs/honojs/discussions/2291 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
tags: | ||
- seed | ||
- orm | ||
- drizzle | ||
--- | ||
DrizzleはSQLクエリビルダーなので、オブジェクトにマッピングされない。flatにクエリ出力される。(SQLと同じだ) | ||
|
||
[Drizzle Queries](https://orm.drizzle.team/docs/rqb)を使用した場合、オブジェクトにマッピングされる。その際はSQL上でjsonを整形した上でキャストされるので高速だが、nestした場合(a -> b -> c)にサブクエリが3階層となり、aliasが繋がらないSQL生成結果となってしまった。つまりうまくクエリ生成ができなかった。 | ||
|
||
そのため、[Aggregating results](https://orm.drizzle.team/docs/joins#aggregating-results) という形で集計する。 | ||
|
||
- [【Drizzle ORM】JOINした結果をマッピングして集計する](https://pote-chil.com/posts/drizzleorm-join-aggregate) | ||
- [Drizzle Team Community - Answer Overflow](https://www.answeroverflow.com/c/1043890932593987624) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
tags: | ||
- typescript | ||
- seed | ||
--- | ||
## TypeScriptで `@/xx`でアクセスする | ||
|
||
```json | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": ["src/*"] | ||
} | ||
``` |