constlimit=50;constrows=awaitdb.query(`SELECT * FROM orders WHERE (created_at, id) < ($1, $2)
ORDER BY created_at DESC, id DESC LIMIT $3`,[cursor.ts,cursor.id,limit+1]);consthasMore=rows.length>limit;constitems=rows.slice(0,limit);constnextCursor=hasMore?encode(items.at(-1)):null;
언제: 매 cross-system contract 의 design, 매 client/server 매 separated, 매 versioned interface 필요.
언제 X: 매 internal function call (just call it), 매 single process, 매 < 100 lines glue script.
❌ 안티패턴
GET with side effects: 매 cache poisoning, 매 idempotency violation.
HTTP 200 with {error: ...} body: 매 status code semantics 의 ignore.
Versioning by minor change: 매 v1/v2/v3 explosion. 매 additive evolution 의 prefer.
Chatty API: 매 N+1 client roundtrips. 매 batch endpoint or GraphQL.