sres
v0.2.0
Published
Nitroでの使用を想定した、Responseクラスを使用しないtype safeな独自Responseオブジェクトgenerator
Downloads
137
Readme
sRes
Nitroでの使用を想定した、Responseクラスを使用しないtype safeな独自Responseオブジェクトgenerator
WIP: 開発途中です。
サンプルコード
import { sRes } from 'sres'
return sRes<UserObject>(event, {
status: 200, // h3のsetResponseStatusを使用して、statusCodeがセットされます。
statusText: 'ok', // h3のsetResponseStatusを使用して、statusMessageがセットされます。
error: e, // サーバーログに表示させたいスタックトレースを渡します
logMessage: 'success', // サーバーログに出力できます。
data: user // 返却するObjectを格納します。genericsで指定した型があたります。
})