@aegenet/belt-fastify-abort
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

npm version

@aegenet/belt-fastify-abort

Auto add an AbortController on all Fastify Request

Node only!

💾 Installation

yarn add @aegenet/belt-fastify-abort@^2.0.0
# or
npm i @aegenet/belt-fastify-abort@^2.0.0

📝 Usage

Node.js

import { fastifyAbortRegister, type FastifyRequestAbortCtrl } from '@aegenet/belt-fastify-abort';
import fastify from 'fastify';

const app = fastify();
// register the fastify abort
fastifyAbortRegister(app);

fastify.post('/api/random', async (request: FastifyRequestAbortCtrl, reply) => {
  // AbortController is available in abortCtrl
  assert.ok(request.abortCtrl);

  /** your code */
  reply.code(200).send({});
});

Package Sidebar

Install

npm i @aegenet/belt-fastify-abort

Weekly Downloads

67

Version

2.3.0

License

MIT

Unpacked Size

7.45 kB

Total Files

10

Last publish

Collaborators

  • agenet