{"id":21873254,"url":"https://github.com/pr4j3sh/exhandlers","last_synced_at":"2026-02-18T20:31:20.033Z","repository":{"id":261091659,"uuid":"883225485","full_name":"pr4j3sh/exhandlers","owner":"pr4j3sh","description":"Utility middlewares for working with Expressjs","archived":false,"fork":false,"pushed_at":"2025-04-17T17:49:11.000Z","size":790,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-28T02:56:16.541Z","etag":null,"topics":["backend","express","expressjs","handlers","server","utility"],"latest_commit_sha":null,"homepage":"https://pr4j3sh.github.io/exhandlers/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pr4j3sh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-04T15:37:47.000Z","updated_at":"2025-04-17T17:49:15.000Z","dependencies_parsed_at":"2024-11-04T17:22:20.226Z","dependency_job_id":"734458f2-f703-4a85-ae32-be3fc22be605","html_url":"https://github.com/pr4j3sh/exhandlers","commit_stats":null,"previous_names":["pr4j3sh/express-handlers"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/pr4j3sh/exhandlers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pr4j3sh%2Fexhandlers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pr4j3sh%2Fexhandlers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pr4j3sh%2Fexhandlers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pr4j3sh%2Fexhandlers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pr4j3sh","download_url":"https://codeload.github.com/pr4j3sh/exhandlers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pr4j3sh%2Fexhandlers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29594259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T18:54:29.675Z","status":"ssl_error","status_checked_at":"2026-02-18T18:50:50.517Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","express","expressjs","handlers","server","utility"],"created_at":"2024-11-28T07:07:16.834Z","updated_at":"2026-02-18T20:31:20.017Z","avatar_url":"https://github.com/pr4j3sh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# exhandlers\n\n`exhandlers` is a comprehensive collection of middleware and handler functions designed to streamline backend development in Express.js. It provides pre-built utilities for handling databases, WebSocket connections, AMQP connections, logging, and various other essential middleware functionalities.\n\nBy integrating `exhandlers`, developers can eliminate the need to write common handlers from scratch, thereby reducing development overhead and ensuring a cleaner, more maintainable codebase.\n\n## Documentation\n\n[exhandlers Documentation](https://pr4j3sh.github.io/exhandlers/)\n\n## Available Handlers\n\n### Core Middleware\n\n- **Asynchronous Handler** – Simplifies error handling in async functions.\n- **Authentication Handler** – Manages authentication and authorization mechanisms.\n- **CORS Handler** – Configures Cross-Origin Resource Sharing (CORS) policies.\n- **Error Handler** – Centralized error handling middleware.\n- **Not Found Handler** – Handles 404 (Not Found) errors.\n- **Logs Handler** – Structured logging for application monitoring.\n- **Rate Limiting Handler** – Protects APIs from excessive requests.\n- **Password Handler** – Utility functions for password hashing and validation.\n- **Token Handler** – Utility function for password hashing and validation.\n\n### Database Handlers\n\n- **MongoDB Handler** – Provides a streamlined connection and query interface for MongoDB.\n- **PostgreSQL Handler** – Manages PostgreSQL database connections and queries.\n- **Redis Handler** – Integrates Redis for caching and session management.\n\n### Additional Handlers\n\n- **Upload Handler** – Manages file uploads efficiently.\n- **Socket Handler** – Handles WebSocket connections for real-time data exchange.\n- **AMQP Handler** – Facilitates message queue communication using AMQP (e.g., RabbitMQ).\n\n## Installation\n\nTo integrate `exhandlers` into your project, install the package using npm:\n\n```sh\nnpm install exhandlers\n```\n\n# Usage\n\nTo use `exhandlers` in your Express application, import the required handlers using `require`.\n\n```js\nconst {\n  asyncHandler,\n  errorHandler,\n  notFoundHandler,\n  corsHandler,\n  rateLimitHandler,\n} = require(\"exhandlers\");\n\nconst express = require(\"express\");\n\nconst app = express();\n\n// Apply CORS middleware\napp.use(corsHandler());\n\n// Apply rate limiting middleware\napp.use(rateLimitHandler({ windowMs: 15 * 60 * 1000, limit: 100 })); // 100 requests per 15 minutes\n\n// Define an asynchronous route using asyncHandler\napp.get(\n  \"/data\",\n  asyncHandler(async (req, res) =\u003e {\n    const data = await fetchDataFromDB(); // Simulated database call\n    res.json({ success: true, data });\n  }),\n);\n\n// Handle 404 errors\napp.use(notFoundHandler());\n\n// Centralized error handling middleware\napp.use(errorHandler());\n\n// Start the server\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () =\u003e {\n  console.log(`Server is running on port ${PORT}`);\n});\n\n// Sample function simulating database fetch\nasync function fetchDataFromDB() {\n  return { message: \"Hello from the database!\" };\n}\n```\n\nThis setup ensures your Express server is optimized for security, error handling, and performance.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpr4j3sh%2Fexhandlers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpr4j3sh%2Fexhandlers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpr4j3sh%2Fexhandlers/lists"}