Skip to content

Commit

Permalink
Quartz sync: Nov 17, 2024, 10:37 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
nitaking committed Nov 17, 2024
1 parent 7c6a0f8 commit 8122cc4
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
31 changes: 31 additions & 0 deletions content/posts/hono_clientでCORS対応をする.md
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
2 changes: 1 addition & 1 deletion content/thoughts/About index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tags:
- node
- seed
---
Node.jsの作者はindex.jsを後悔している
Node.jsの作者はindex.jsの仕組みを後悔している

<iframe width="560" height="315" src="https://www.youtube.com/embed/M3BM9TB-8yA?si=ARcGfjIM1BcPxvxH&amp;start=893" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

Expand Down
14 changes: 14 additions & 0 deletions content/thoughts/DrizzleORM > Join結果のマッピング.md
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)
8 changes: 7 additions & 1 deletion content/thoughts/Node ORM.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ tags:
> Node, もしくはTypeScript実行環境(Bun, Deno etc...)

- Knex
- Knex: SQL Query Builder
- [SQL Query Builder for Javascript | Knex.js](https://knexjs.org/)
- メンテナンスされていない可能性がある
- Drizzle
- [Drizzle ORM - Why Drizzle?](https://orm.drizzle.team/docs/overview#why-sql-like)
- まだ0.xバージョンであり、1.0ではなく安定していないが、わかりやすくパフォーマンスに優れた期待値の高いQueryBuilder/ORMである
- Kysely
- SQL QueryBuilder
- [Kysely | Kysely](https://kysely.dev/)
-

---
- https://www.reddit.com/r/node/comments/14lyyia/prisma_vs_drizzle_orm_for_production/
13 changes: 13 additions & 0 deletions content/thoughts/TypeScript path alias.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
tags:
- typescript
- seed
---
## TypeScriptで `@/xx`でアクセスする

```json
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
```

0 comments on commit 8122cc4

Please sign in to comment.