Enhanced HTTP Response class with convenient static methods for common scenarios. A lightweight wrapper around the native Response class for Node.js and browser environments.
- 🛠️ Extends standard
Responsewith zero overhead - 🎯 Full TypeScript support with native types
- ⚡ Static helpers for common HTTP scenarios
- 📡 Works seamlessly with standard Fetch API
- 🚀 No dependencies, minimal footprint
@dep/response is published on JSR.io and is primarily designed for Deno. It can also be used in Node.js (18+) and browsers via JSR.
-
Deno:
import { HttpResponse } from 'jsr:@dep/response';
-
Node.js (18+) or Browsers:
npx jsr add @dep/response
Then import as an ES module:
import { HttpResponse } from '@dep/response';
import { HttpResponse } from '@dep/response';
// Success responses
HttpResponse.json({ data: user });
HttpResponse.success(user, 'User found');
HttpResponse.created(newUser, 'User created successfully');
// Error responses
HttpResponse.notFound('User not found');
HttpResponse.unauthorized('Invalid credentials');
HttpResponse.serverError('DATABASE_ERROR', 'Unable to connect');
// Special responses
HttpResponse.noContent();
HttpResponse.redirect('/login');MIT License – see LICENSE for details.
Author: Estarlin R (estarlincito.com)