Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement rate limiting to prevent abuse and ensure service stability #41

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Implement rate limiting to prevent abuse and ensure service stability #41

merged 1 commit into from
Oct 25, 2024

Conversation

thedemonsid
Copy link
Contributor

@thedemonsid thedemonsid commented Oct 22, 2024

Fixes #40

Implement rate limiting to prevent excessive requests and ensure service stability.

  • Add express-rate-limit middleware to pages/api/exam-result.js and pages/api/scholarship-data.js to limit requests to 100 per 15 minutes per IP address.
  • Handle blocked requests gracefully by returning a 429 status code with a custom message in both API files.
  • Update package.json to include express-rate-limit dependency.
  • Add logic to pages/college_predictor.js and pages/scholarships_result.js to handle 429 status code and display a "Rate limit exceeded" message to the user.

For more details, open the Copilot Workspace session.

Fixes #40

Implement rate limiting to prevent excessive requests and ensure service stability.

* Add `express-rate-limit` middleware to `pages/api/exam-result.js` and `pages/api/scholarship-data.js` to limit requests to 100 per 15 minutes per IP address.
* Handle blocked requests gracefully by returning a 429 status code with a custom message in both API files.
* Update `package.json` to include `express-rate-limit` dependency.
* Add logic to `pages/college_predictor.js` and `pages/scholarships_result.js` to handle 429 status code and display a "Rate limit exceeded" message to the user.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/avantifellows/college-predictor/issues/40?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link
Contributor

@suryabulusu suryabulusu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great

@suryabulusu suryabulusu merged commit 72f48b3 into avantifellows:main Oct 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Rate Limiting to Prevent Abuse and Ensure Service Stability
2 participants