nexus-req
Typescript library for normalizing server responses in full stack web applications
Introduction
Installation
bun i nexus-reqnpm i nexus-reqUsage.
sendServerResponse
import { sendServerResponse } from 'nexus-req';
import type { ErrorCodes } from 'nexus-req';
const response = sendServerResponse<ErrorCodes>(400, 'This user is unauthorized to access this information.');
console.log(response)
/**
returns {
ok: false
status: 400
message: 'This user is unauthorized to access this information.'
data: null
}
**/
Last updated