{"id":29643087,"url":"https://github.com/raito-cache-server/raito-expressjs","last_synced_at":"2025-07-21T23:02:42.490Z","repository":{"id":268355664,"uuid":"904078313","full_name":"raito-cache-server/raito-expressjs","owner":"raito-cache-server","description":"API and middleware for expressjs to communicate with raito-cache server","archived":false,"fork":false,"pushed_at":"2024-12-18T09:23:25.000Z","size":215,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T15:56:02.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/raito-cache-server.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-16T08:03:38.000Z","updated_at":"2024-12-19T09:41:54.000Z","dependencies_parsed_at":"2024-12-16T09:24:57.710Z","dependency_job_id":"b0e1b0ef-e5dd-4046-acff-4992a71f5eb3","html_url":"https://github.com/raito-cache-server/raito-expressjs","commit_stats":null,"previous_names":["stbestichhh/raito-expressjs"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/raito-cache-server/raito-expressjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raito-cache-server%2Fraito-expressjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raito-cache-server%2Fraito-expressjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raito-cache-server%2Fraito-expressjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raito-cache-server%2Fraito-expressjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raito-cache-server","download_url":"https://codeload.github.com/raito-cache-server/raito-expressjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raito-cache-server%2Fraito-expressjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266398442,"owners_count":23922461,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-07-21T23:02:41.468Z","updated_at":"2025-07-21T23:02:42.482Z","avatar_url":"https://github.com/raito-cache-server.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM Version](https://img.shields.io/npm/v/@raito-cache/expressjs)](https://www.npmjs.com/package/@raito-cache/expressjs)\n[![Node.js CI](https://github.com/stbestichhh/raito-expressjs/actions/workflows/node.js.yml/badge.svg)](https://github.com/stbestichhh/raito-expressjs/actions/workflows/node.js.yml)\n[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n\n# raito-expressjs\n\n## Table of contents\n\n* [Description](#about)\n* [Getting started](#getting-started)\n* [API](#api)\n* [Deployment](#deployment)\n* [Contributing](#contributing)\n* [Changelog](#changelog)\n* [Authors](#authors)\n* [License](#license)\n\n## About\n\n**raito-expressjs** - is an express.js middleware and API for communicating with **[Raito](https://github.com/stbestichhh/raito-cache) cache server**.\n\n## Getting started\n\n\u003e [!IMPORTANT]\n\u003e **Node.js 18.x+** version must be installed in your OS.\n\n#### 1. Install server\n  ```shell\n  $ yarn add express\n  $ yarn add @raito-cache/expressjs\n  ```\n\n#### 2. Connect to Raito\n```typescript\nimport { Raito } from '@raito-cache/expressjs';\n\nconst raito = new Raito(); // defaul connection is localhost:9180\n```\n\n#### 3. Use middleware\n```typescript\nimport { cacheResponse } from '@raito-cache/expressjs'\n\napp.get('/api/route', cacheResponse());\n```\n\n## API\n\n### Connect to Raito\n```typescript\nnew Raito(); // Connect to localhost:9180\nnew Raito(7180); // localhost:7180\nnew Raito('raito://localhost:9180'); // localhost:9180\nnew Raito('raito://localhost:9180?ttl=5000'); // localhost:9180 and ttl 5s\nnew Raito({\n  port: 9180, // Raito port\n  host: 'localhost', // Raito host\n  ttl: 10000, // Cache records time to live\n});\n```\n\n### Usage\n\n**Raito class**\n```typescript\nimport { Raito } from '@raito-cache/expressjs';\n\nconst raito = new Raito();\n\nawait raito.set('key', { data: 'some data' }); // Create new record\nawait raito.set('key2', 'other data', 15000); // Create new record with 15s ttl\n\nawait raito.get('key2'); // Output: { key: 'key', data: 'other data', createdAt: Date, ttl: 15000 }\nawait raito.clear('key'); // Deletes record\n\nawait raito.shutdown(); // Close connection\n```\n\n**Express.js middleware**\n```typescript\nimport { cacheResponse } from '@raito-cache/expressjs'\nimport { Raito } from '@raito-cache/expressjs';\n\nconst raito = new Raito();\n\napp.get('/api/route', cacheResponse()); // Caches responses\napp.get('/api/timeSensetive/data', cacheResponse(15000)); // Cache response with setting record ttl\n```\n\n## Raito Deployment\n1. Pull docker image:\n  ```shell\n  $ docker pull stbestich/raito-cache:latest\n  ```\n2. Run it\n  ```shell\n  $ docker run -e HOST=\u003chost\u003e -p \u003cport\u003e:9180 -it stbestich/raito-cache\n  ```\n\n#### Use with docker-compose\n```yaml\nservices:\n  raito-cache:\n    image: stbestich/raito-cache:latest\n    ports:\n      - \"${PORT:-9180}:${PORT:-9180}\"\n      - \"${PORT:-9181}:${PORT:-9181\" # Define second port if you need http proxy\n    env_file:\n      - .env\n    environment:\n      NODE_ENV: production\n      PORT: ${PORT:-9180}\n      HOST: ${HOST:-0.0.0.0}\n      TTL: ${TTL}\n    tty: true\n    stdin_open: true\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Changelog\n\nProject changes are writen in changelog, see the [CHANGELOG.md](CHANGELOG.md).\n\nWe use [SemVer](https://semver.org/) for versioning.\nFor the versions available, see the [tags](https://github.com/stbestichhh/raito-expressjs/tags) on this repository.\nFor the versions supported, see the [SECURITY.md](SECURITY.md).\n\n## Authors\n\n- [@stbestichhh](https://www.github.com/stbestichhh)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraito-cache-server%2Fraito-expressjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraito-cache-server%2Fraito-expressjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraito-cache-server%2Fraito-expressjs/lists"}