Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-throttle-module

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-throttle-module

This module is designed to limit the number of requests made to the server from a single IP address and and the total number of participants

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Nuxt Throttle Module

This module is designed to limit the number of requests made to the server from a single IP address and and the total number of participants for nuxt 2 and nuxt 3. It defines a Nuxt module that can be used in a Nuxt application.

The module requires Redis to work. See ENV for more information.

Quick Setup

  1. Add nuxt-throttle-module dependency to your project
# Using pnpm
pnpm add -D nuxt-throttle-module

# Using yarn
yarn add --dev nuxt-throttle-module

# Using npm
npm install --save-dev nuxt-throttle-module
  1. Add nuxt-throttle-module to the modules section of nuxt.config.ts

nuxt 3

export default defineNuxtConfig({
  modules: [
    'nuxt-throttle-module'
  ],
  throttleModule: {
    ipMaxCount: 200,
    minuteMaxCount: 2000,
    secondMaxCount: 20,
  }
})

nuxt 2

export default {
  modules: [
    'nuxt-throttle-module'
  ],
  throttleModule: {
    ipMaxCount: 200,
    minuteMaxCount: 2000,
    secondMaxCount: 20,
  }
}

That's it! You can now use My Module in your Nuxt app ✨

Options

The module accepts configuration options in the form of a TypeScript interface ModuleOptions. These options include:

  • ipMaxCount - the maximum number of requests that can be made from a single IP address
  • minuteMaxCount - the maximum number of requests that can be made in a minute
  • secondMaxCount - the maximum number of requests that can be made in a second
  • prefix - redis prefix
  • time - time for clean redis These options can be overridden when initializing the module.

ENV

  • process.env.REDIS_HOST - redis host
  • process.env.REDIS_PORT - redis port

Keywords

FAQs

Package last updated on 12 Apr 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc