This simple application demonstrates how to implement Rate limiting for Express.js routes.
- Go to unkey_ratelimits
- create a new namespace, remember you have to use this namespace in the code , for this particular template keep namespace as "email.inbound"
- Go to settings/root-keys and create a root key with Ratelimit permissions
- Add it in the .env file UNKEY_ROOT_KEY
- Node
- An unkey account and a root-key
- Clone this repository:
git clone https://github.com/FaheemOnHub/UnkeyExpressExample.git
- Set up your environment variables: Create a .env file in the project root and add the following variables. Get the Unkey rootkey from settings , then Root Keys
UNKEY_ROOT_KEY=your_unkey_root_key
- Install the required dependencies
npm install
- Start the project:
node index.js or nodemon index.js
Can be tested using Postman ,Visit route using POST http://localhost:3000/api/hello ,Provide body:
UserID:"any_number"