{"id":16374796,"url":"https://github.com/jameslnewell/removable-middleware","last_synced_at":"2026-05-09T19:43:18.596Z","repository":{"id":57353271,"uuid":"84000996","full_name":"jameslnewell/removable-middleware","owner":"jameslnewell","description":"A middleware wrapper allowing you to remove and replace the wrapped middleware while the server is running.","archived":false,"fork":false,"pushed_at":"2017-03-06T04:32:58.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T16:18:28.130Z","etag":null,"topics":["connectjs","expressjs","middleware","removable","replacable"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jameslnewell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-05T20:46:05.000Z","updated_at":"2017-03-05T20:47:19.000Z","dependencies_parsed_at":"2022-09-14T19:23:25.109Z","dependency_job_id":null,"html_url":"https://github.com/jameslnewell/removable-middleware","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameslnewell%2Fremovable-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameslnewell%2Fremovable-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameslnewell%2Fremovable-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jameslnewell%2Fremovable-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jameslnewell","download_url":"https://codeload.github.com/jameslnewell/removable-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239946871,"owners_count":19723014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["connectjs","expressjs","middleware","removable","replacable"],"created_at":"2024-10-11T03:18:24.933Z","updated_at":"2026-03-26T16:30:16.432Z","avatar_url":"https://github.com/jameslnewell.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# removable-middleware\n\nA middleware wrapper allowing you to remove and replace the wrapped middleware while the server is running.\n\n\u003e WARNING: It is not recommended to remove or replace middleware in a production\napp [#2418](https://github.com/expressjs/express/issues/2418). However, removing middleware during development can be useful e.g. for\ncode-splitting.\n\n## Installation\n\n    npm install --save removable-middleware\n\n## Usage\n\n\u003e Example: Hot-reloading a server app bundled with Webpack:\n\n```js\nimport express from 'express';\nimport removableMiddleware from 'removable-middleware';\nimport myAppMiddleware from './myAppMiddleware';\n\nconst app = express();\nconst middleware = removableMiddleware(myAppMiddleware);\n\napp\n\t.use(middleware)\n\t.listen(3000)\n;\n\nif(module.hot) {\n\tmodule.hot.accept('./myAppMiddleware', () =\u003e {\n\t\timport('./myAppMiddleware').then(module =\u003e middleware.replace(module.default));\n\t});\n}\n\n```\n\n## API\n\n### `removableMiddleware(initialMiddleware)`\n\nCreates a new middleware that wraps the another middleware.\n\n### `.replace(nextMiddleware)`\n\nReplaces the wrapped middleware with another middleware.\n\n### `.remove()`\n\nRemoves the wrapped middleware.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameslnewell%2Fremovable-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjameslnewell%2Fremovable-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameslnewell%2Fremovable-middleware/lists"}