@nbn23/plugin-http-error
v1.0.0-beta-1
Published
HTTP error plugin
Downloads
1
Readme
NBN23 HTTP error plugin
HTTPErrorPlugin is a GraphQL plugin that handles HTTP codes on a GraphQL response rather than return always 200. This plugin handles the error codes through the HTTPError class.
Getting Started
Install HTTPErrorPlugin using npm.
npm install --save @nbn23/plugin-http-error
Note: CloudTasks assumes a TypeScript environment
Usage
import { HTTPErrorPlugin } from "@nbn23/plugin-http-error";
const server = new ApolloServer({
...
plugins: [new HTTPErrorPlugin()]
});
throw new HTTPError(404, "Bad request.");