@mountainpass/problem-document
v0.0.46
Published
A basic RFC7807 Problem Details document with basic type checking and autocomplete
Downloads
62
Readme
problem-document
A basic RFC7807 Problem Details document with basic type checking and autocomplete
Installation
npm
run the following command in your project
npm install @mountainpass/problem-document
yarn
run the following command in your project
yarn add @mountainpass/problem-document
projen
Add @mountainpass/problem-document
to your deps
in your .projen.js
or projen.ts
. e.g.
///...
const project = new NodeProject({
//...
deps: [
//...
'@mountainpass/problem-document'
]
});
and run npx projen
Usage
import { ProblemDocument } from "@mountainpass/problem-document";
//...
const problemDocument = new ProblemDocument({
type: "https://example.com/probs/out-of-credit",
title: "You do not have enough credit.",
detail: "Your current balance is 30, but that costs 50.",
instance: "/account/12345/msgs/abc",
balance: 30,
accounts: ["/account/12345",
"/account/67890"]
});