{"id":20489598,"url":"https://github.com/telus/cachepile-middleware","last_synced_at":"2025-03-05T17:17:43.493Z","repository":{"id":43669916,"uuid":"145167990","full_name":"telus/cachepile-middleware","owner":"telus","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-11T07:46:34.000Z","size":388,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T05:14:01.896Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-17T21:27:07.000Z","updated_at":"2019-03-12T14:40:51.000Z","dependencies_parsed_at":"2023-01-25T16:31:26.164Z","dependency_job_id":null,"html_url":"https://github.com/telus/cachepile-middleware","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telus%2Fcachepile-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telus%2Fcachepile-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telus%2Fcachepile-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telus%2Fcachepile-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telus","download_url":"https://codeload.github.com/telus/cachepile-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242067713,"owners_count":20066751,"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":[],"created_at":"2024-11-15T17:13:28.614Z","updated_at":"2025-03-05T17:17:43.454Z","avatar_url":"https://github.com/telus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](https://github.com/cachepile/brand/blob/master/logo.svg)\n\n# Cachepile Express Middleware [![version][npm-version]][npm-url] [![License][license-image]][license-url] [![Build Status][travis-image]][travis-url]\n\n\u003e [CachePile][cachepile] Express Middleware\n\n## Install\n\n```bash\nnpm install --production --save @cachepile/middleware\n```\n\n## API\n\n### lib()\n\n#### Middleware usage\n\n```js\nconst express = require('express')\nconst middleware = require('@cachepile/middleware')\n\nconst app = express()\napp.use(middleware())\napp.listen(3000, () =\u003e  console.log(`Cachepile listening on 3000`))\n```\n\n#### Configs\n\nYou can pass in an options object into the middleware initialization.  Here are the options:\nKey          | Description                                          | Default Value\n------------ | ---------------------------------------------------- | --------------\nheaderPrefix | specify the prefix for the headers                   | cp\nredis        | redis node is used under the hood.  See a list of options [here](https://github.com/NodeRedis/node_redis#rediscreateclient)\n\n#### Client usage\n\n```bash\n# call api to cache through the proxy\ncurl -i -H \"cp-target-port: 443\" -H \"cp-ttl: 10\" -H \"CP-TARGET-HOST: reqres.in\" -H \"CP-TARGET-PROTO: https\"  localhost:3000/api/users\n```\n\n#### Headers\n\nHeader          | Description                                          | Default Value\n--------------- | ---------------------------------------------------- | --------------\nCP-FORCE        | Force request to call through to specified end point | false\nCP-TARGET-HOST  | host of endpoint to cache                            | requested host\nCP-TARGET-PORT  | port of endpoint to cache                            | requested port\nCP-TARGET-PROTO | protocol for endpoint to cache                       | http\nCP-TTL          | time in seconds to cache response                    | 1\nCP-WAIT         | if set to false(default) the proxy will wait for the response from the server before responding to the client request.  Otherwise, it will return 201 and fetch the request in the background. | false\n---\n\n\u003e License: [ISC][license-url] •\n\u003e Copyright: [ahmadnassri.com](https://www.ahmadnassri.com) •\n\u003e Github: [@ahmadnassri](https://github.com/ahmadnassri) •\n\u003e Twitter: [@ahmadnassri](https://twitter.com/ahmadnassri)\n\n[license-url]: http://choosealicense.com/licenses/isc/\n\n[license-image]: https://img.shields.io/github/license/cachepile/middleware.svg?style=flat-square\n\n[travis-url]: https://travis-ci.org/cachepile/middleware\n\n[travis-image]: https://img.shields.io/travis/cachepile/middleware.svg?style=flat-square\n\n[npm-url]: https://www.npmjs.com/package/@cachepile/middleware\n\n[npm-version]: https://img.shields.io/npm/v/@cachepile/middleware.svg?style=flat-square\n\n[cachepile]: https://cachepile.github.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelus%2Fcachepile-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelus%2Fcachepile-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelus%2Fcachepile-middleware/lists"}