{"id":19014422,"url":"https://github.com/vaneenige/unvault-middleware","last_synced_at":"2025-06-15T12:32:18.807Z","repository":{"id":57386971,"uuid":"118965735","full_name":"vaneenige/unvault-middleware","owner":"vaneenige","description":"📦 A middleware to automatically setup routes, store expected responses and deliver results fast.","archived":false,"fork":false,"pushed_at":"2018-01-27T16:51:10.000Z","size":4,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T00:43:57.046Z","etag":null,"topics":["api","middleware","node","responses","routing","server","store"],"latest_commit_sha":null,"homepage":"","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/vaneenige.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-25T20:44:58.000Z","updated_at":"2022-02-06T16:10:31.000Z","dependencies_parsed_at":"2022-09-15T03:01:55.507Z","dependency_job_id":null,"html_url":"https://github.com/vaneenige/unvault-middleware","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaneenige%2Funvault-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaneenige%2Funvault-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaneenige%2Funvault-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaneenige%2Funvault-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaneenige","download_url":"https://codeload.github.com/vaneenige/unvault-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250348883,"owners_count":21415907,"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":["api","middleware","node","responses","routing","server","store"],"created_at":"2024-11-08T19:29:26.006Z","updated_at":"2025-04-23T00:44:02.711Z","avatar_url":"https://github.com/vaneenige.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003eUnvault Middleware\u003c/h1\u003e\n\nAs the name suggests this is a middleware based on [unvault](https://github.com/vaneenige/unvault), a minimal layer for node that allows results of time-consuming tasks to be stored. This middleware only needs a simple configuration to automatically setup routes, store expected responses and deliver results fast (see [benchmarks](https://github.com/vaneenige/unvault#benchmarks)).\n\n\u003ca href=\"https://www.npmjs.org/package/unvault-middleware\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/unvault-middleware.svg?style=flat\" alt=\"npm\"\u003e\n\u003c/a\u003e\n\n## Install\n\n```\n$ npm install --save unvault-middleware\n```\n\n## Usage\n\n```js\nconst polka = require(\"polka\");\nconst middleware = require(\"unvault-middleware\");\n\nconst route = {\n  path: \"/random\",\n  headers: { \"Content-Type\": \"application/json\" },\n  interval: 1000,\n  update: () =\u003e {\n    return JSON.stringify({\n      random: Math.random()\n    });\n  }\n};\n\npolka()\n  .use(middleware([route]))\n  .listen(3000);\n```\n\n**Result:** The example above creates a node server (in this case with [Polka](https://github.com/lukeed/polka)) that uses the middleware. The added route (`http://localhost:3000/random`) will return a stored JSON (based on headers) response with a random value that is updated automatically every second.\n\n## License\n\nMIT © [Colin van Eenige](https://use-the-platform.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaneenige%2Funvault-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaneenige%2Funvault-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaneenige%2Funvault-middleware/lists"}