{"id":21466588,"url":"https://github.com/permafrost-dev/express-ray","last_synced_at":"2025-07-15T05:30:50.917Z","repository":{"id":36953230,"uuid":"469332675","full_name":"permafrost-dev/express-ray","owner":"permafrost-dev","description":"Debug express.js server code with Ray to fix problems faster","archived":false,"fork":false,"pushed_at":"2023-11-20T10:00:02.000Z","size":197,"stargazers_count":8,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T11:30:36.944Z","etag":null,"topics":["debugging","express-js","express-middleware","expressjs","middleware","ray-app","spatie","typescript"],"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/permafrost-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null},"funding":{"github":"permafrost-dev","custom":"https://permafrost.dev/open-source"}},"created_at":"2022-03-13T10:05:01.000Z","updated_at":"2022-11-03T09:07:50.000Z","dependencies_parsed_at":"2023-02-13T19:45:38.987Z","dependency_job_id":null,"html_url":"https://github.com/permafrost-dev/express-ray","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"permafrost-dev/typescript-project-skeleton-esbuild-jest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permafrost-dev%2Fexpress-ray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permafrost-dev%2Fexpress-ray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permafrost-dev%2Fexpress-ray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permafrost-dev%2Fexpress-ray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/permafrost-dev","download_url":"https://codeload.github.com/permafrost-dev/express-ray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017177,"owners_count":17560466,"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":["debugging","express-js","express-middleware","expressjs","middleware","ray-app","spatie","typescript"],"created_at":"2024-11-23T08:14:40.450Z","updated_at":"2024-11-23T08:14:41.225Z","avatar_url":"https://github.com/permafrost-dev.png","language":"JavaScript","funding_links":["https://github.com/sponsors/permafrost-dev","https://permafrost.dev/open-source"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e    \n    \u003cimg src=\"https://user-images.githubusercontent.com/5508707/158072103-6b329884-c4fa-42f6-8e55-c753bc73374c.png\" alt=\"logo\" height=\"110\" /\u003e\n\u003c/p\u003e\n\n# express-ray\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://shields.io/npm/v/express-ray\" alt=\"npm version\"\u003e\n    \u003cimg src=\"https://shields.io/github/license/permafrost-dev/express-ray?logo=opensourceinitiative\u0026logoColor=white\" alt=\"license\"\u003e\n    \u003cimg src=\"https://github.com/permafrost-dev/express-ray/workflows/Run%20Tests/badge.svg\" alt=\"test status\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/permafrost-dev/express-ray/branch/main/graph/badge.svg?token=1tgFqjGUPF\"/\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dt/express-ray.svg?logo=npm\" alt=\"npm downloads\"\u003e\n\u003c/p\u003e\n\nInstall this package in any Express.js project to provide an exceptional debugging experience using the [Ray app](https://myray.app) by [Spatie](https://spatie.be).\n\n---\n\n## Installation\n\nInstall this package with `npm`:\n\n```bash\nnpm install express-ray\n```\n\n## Usage\n\n### Plugin Installation\n\nTo install the `express-ray` plugin, call the `install` method provided by the `plugin` import:\n\n```js\nimport { plugin as expressRayPlugin } from 'express-ray';\n\nconst app = express();\n\nexpressRayPlugin.install(app);\n```\n\nOnce installed, access ray via the `app.$ray()` method. See the documentation for the [node-ray](https://github.com/permafrost-dev/node-ray) package for a list of available methods.\n\n```js\napp.get('/', (req, res) =\u003e {\n    app.$ray('sending \"hello world\" response');\n    res.send('hello world');\n});\n```\n\n### Methods\n\nThe `app.$ray()` method provides additional helper methods specifically for express applications.\n\n| Method                  | Description                                                    |\n| ----------------------- | -------------------------------------------------------------- |\n| `$ray().request(req)`   | Sends information about the request object to Ray              |\n\n```js\napp.get('/api/test', (req, res) =\u003e {\n    app.$ray().request(req);\n    res.send({ message: 'hello world' });\n});\n```\n\n### Middleware\n\n#### SendRequestToRay\n\nSend details about each request to Ray with the `SendRequestToRay` middleware, optionally specifying configuration settings.\n\n```ts\ninterface SendRequestToRayOptions {\n    methods?: HttpMethod[];\n    paths?: {\n        include?: string[];\n        ignore?: string[];\n    };\n}\n```\n\nBy default, all paths and http methods match and get sent to Ray. The `paths.include`, `paths.ignore`, and `methods` configuration settings support wildcards.\n\n```js\nimport { middleware } from 'express-ray';\n\napp.use(\n    middleware.SendRequestToRay({ \n        methods: [HttpMethod.GET],\n        paths: { include: ['/api/*'], ignore: ['/api/ignored'] } \n    })\n);\n```\n\nAll configuration settings for this middleware are optional:\n\n```js\napp.use(middleware.SendRequestToRay());\n```\n\n![image](https://user-images.githubusercontent.com/5508707/158073710-37209980-63b0-4812-9687-f3c1b7c721ab.png)\n\n#### SendErrorToRay\n\nTo send errors directly to Ray, use the `SendErrorToRay` middleware.\n\n```js\nimport { middleware } from 'express-ray';\n\n// \u003cexpress setup code here\u003e\n\n// register the middleware just before listen()\napp.use(middleware.SendErrorToRay);\n\napp.listen(port, () =\u003e {\n    console.log(`Listening on port ${port}`);\n});\n```\n\n## Development Setup\n\n```bash\nnpm install\nnpm run build:dev\n```\n\n## Testing\n\n`express-ray` uses Jest for unit tests. To run the test suite:\n\n```bash\nnpm run test\n```\n\n---\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Patrick Organ](https://github.com/patinthehat)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermafrost-dev%2Fexpress-ray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpermafrost-dev%2Fexpress-ray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermafrost-dev%2Fexpress-ray/lists"}