
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@arcjet/decorate
Advanced tools
Arcjet utilities for decorating responses with information
@arcjet/decorate
Arcjet utilities for decorating responses with information.
npm install -S @arcjet/decorate
import arcjet, { fixedWindow } from "@arcjet/next";
import { setRateLimitHeaders } from "@arcjet/decorate";
import { NextApiRequest, NextApiResponse } from "next";
const aj = arcjet({
key: process.env.ARCJET_KEY!, // Get your site key from https://app.arcjet.com
rules: [
// Create a fixed window rate limit. Other algorithms are supported.
fixedWindow({
mode: "LIVE", // will block requests. Use "DRY_RUN" to log only
window: "1m", // 1 min fixed window
max: 1, // allow a single request
}),
],
});
export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
const decision = await aj.protect(req);
setRateLimitHeaders(res, decision);
if (decision.isDenied()) {
return res.status(429).json({
error: "Too Many Requests",
reason: decision.reason,
});
}
res.status(200).json({ name: "Hello world" });
}
Licensed under the Apache License, Version 2.0.
1.0.0-beta.2 (2025-02-04)
isDevelopment
detection (#3012) (f3a45a7)FAQs
Arcjet utilities for decorating responses with information
The npm package @arcjet/decorate receives a total of 1,212 weekly downloads. As such, @arcjet/decorate popularity was classified as popular.
We found that @arcjet/decorate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.