読む人は、JSなしでもぜんぶ読めます。書く人には、書き心地のいい島(Composer)がある。速いページと豊かな編集を両立させたいときの、間取りの見本がこの棟です。
「島(islands)」という言葉が、この館では建築用語です。クライアントで動くJSは対話の縁側だけ。あとはぜんぶサーバで組んだHTML——静かな読書室に、必要なところだけ小さな島が浮かんでいます。
見どころ
- main.tsはFreshのfsRoutesに加えて、GraphQL Yogaのサーバとアップロードのproxyまで同居させ、入口でActorSuspendedError/isActorBannedの門番を通す
- web/db.tsのpostgresプールはmax:20——「配達キューの並列10より広くしないと、連合の混雑時に接続が飢える」というコメントつき
- sitemaps.xml.tsやrobots.txt.tsまで、廊下(routes)の一部としてファイルで置いてある
経文の一節
export const postgres = postgresJs(DATABASE_URL, {
// The pool size needs to exceed the ParallelMessageQueue concurrency (10)
// to leave headroom for HTTP handlers and KV store queries. The default
// of 10 can cause connection starvation under federation load.
max: 20,
});
export const db: Database = drizzle({
relations,
client: postgres,
logger: getDatabaseLogger(),
});