@nbn23/plugin-http-error
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta-1 • Public • Published

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.");

/@nbn23/plugin-http-error/

    Package Sidebar

    Install

    npm i @nbn23/plugin-http-error

    Weekly Downloads

    2

    Version

    1.0.0-beta-1

    License

    ISC

    Unpacked Size

    16.6 kB

    Total Files

    14

    Last publish

    Collaborators

    • nbn
    • maraat