{"_id":"@brainfx/nest-router","_rev":"2-4c8a1d2411227c900c1b8ea1b6195ea8","name":"@brainfx/nest-router","dist-tags":{"latest":"1.0.9-0.0.0"},"versions":{"1.0.9":{"name":"@brainfx/nest-router","version":"1.0.9","description":"Router Module For Nestjs Framework","main":"index.js","scripts":{"test":"jest --notify --config=jest.json","test:watch":"jest --watch --config=jest.json","test:coverage":"jest --config=jest.json --coverage --coverageDirectory=coverage","build":"./scripts/build.sh","build:andMove":"./scripts/build.sh andMove","npm:publish":"cd lib && npm publish"},"repository":{"type":"git","url":"git+https://github.com/brainfx/nest-router.git"},"keywords":["nestjs","router","addons"],"author":{"name":"BrainFx Inc."},"license":"MIT","devDependencies":{"@nestjs/common":"^5.0.0","@nestjs/core":"^5.0.0","@nestjs/testing":"^5.3.11","@types/jest":"^24.0.0","@types/node":"^12.0.0","coveralls":"^3.0.2","jest":"^23.6.0","reflect-metadata":"^0.1.12","rxjs":"^6.3.0","ts-jest":"^24.0.0","typescript":"^3.0.0"},"bugs":{"url":"https://github.com/brainfx/nest-router/issues"},"homepage":"https://github.com/brainfx/nest-router#readme","gitHead":"f7b2374e89f04ddf99c2a94e4edb30f6a41a0dcd","_id":"@brainfx/nest-router@1.0.9","_nodeVersion":"15.10.0","_npmVersion":"7.5.3","dist":{"integrity":"sha512-UpQN8HM+pyogHisYlWfmkgAho+GCMXHQzeeqwNC1j0DPNG9Hh96hq2G9H6odpTJivNxlmX4D4XP2/fkZ6bH9KA==","shasum":"6098db3268b3e5985881479783737f1d7f73c641","tarball":"https://registry.npmjs.org/@brainfx/nest-router/-/nest-router-1.0.9.tgz","fileCount":104,"unpackedSize":1484179,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNX8gCRA9TVsSAnZWagAAbtUQAJDUfO/eaQbWbsZQH9W/\nUkSKNsS0d/ouNI2N18kwjQtSkJ/r64kLBq3cXsg5B7lTPnZ4eElgs9hYtdCw\nooJJde2cFwVMmQRtIm464X/YtcEfFcgsJEhBSkGKvjMwNKTyxmeWKtm4LsgG\nxYrnaxlarQmY+3JiBfadk9I3/ewVPaJj99HDb/WZwDpRfKsEHxCJ4q/Jiy5y\nT9sPL8B4QbyME/6ZZNIK9LgU8+Vku32KDIqrn5Zhx2ugX4da2wzHzwVlkMkO\nogsoc69GLAspgoiZpo8ZvfC/xjBSOIuVVS868yuJ9r1cFIraHYdg/+ol9WWO\nluZxsWpIeqp/I6zHuCvNGx9TMNBuY/0riNoVwVJfznRq7d+aklxytQLT2umH\ncj9w4reMi5YJ4xvGxmJS70KWcmdAoeY4p90qGCEMei+3901gYrUZQUvSuyg8\nsuXzBS6edvtRTTmzn1Jhf7d2sgkf/O26yYplO6iuVJRG0DWiOKOWsW/uiehT\nnUTx1FCBf5JRpwMGOV/KwKixVMW+7jYYkiQK4ed7izfOHg6yYAkKsy0wXx8c\nDObwZu3ZUezP4yEVrCNaQFI8INArONAKnpJt000guCxb+1MAl97x5eE7LEJ+\nW7uccnte35F6yIrizWmXPWK7BfC+LxeXLEzratVdWbUmXzhBJPw8pJaZkTmA\nIhaK\r\n=w1cy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmRJS+gmqPbdeAH2yEOav/k6O7IYySxKuRMu3nIofxhAiBuFGJx34k53m+AzwiYroIfFptcEGDr3Y0VFy5n9JIhQg=="}]},"_npmUser":{"name":"anand-k-p","email":"anand@dhruti.ca"},"directories":{},"maintainers":[{"name":"anthony-bfx","email":"anthony.d@brainfx.com"},{"name":"saaniaki","email":"saaniaki@gmail.com"},{"name":"anand-k-p","email":"anand@dhruti.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nest-router_1.0.9_1614118688377_0.5648312917274974"},"_hasShrinkwrap":false},"1.0.9-0.0.0":{"name":"@brainfx/nest-router","version":"1.0.9-0.0.0","description":"Router Module For Nestjs Framework","main":"index.js","scripts":{"test":"jest --notify --config=jest.json","test:watch":"jest --watch --config=jest.json","test:coverage":"jest --config=jest.json --coverage --coverageDirectory=coverage","build":"./scripts/build.sh","build:andMove":"./scripts/build.sh andMove","npm:publish":"cd lib && npm publish"},"repository":{"type":"git","url":"git+https://github.com/brainfx/nest-router.git"},"keywords":["nestjs","router","addons"],"author":{"name":"BrainFx Inc."},"license":"MIT","devDependencies":{"@nestjs/common":"^5.0.0","@nestjs/core":"^5.0.0","@nestjs/testing":"^5.3.11","@types/jest":"^24.0.0","@types/node":"^12.0.0","coveralls":"^3.0.2","jest":"^23.6.0","reflect-metadata":"^0.1.12","rxjs":"^6.3.0","ts-jest":"^24.0.0","typescript":"^3.0.0"},"bugs":{"url":"https://github.com/brainfx/nest-router/issues"},"homepage":"https://github.com/brainfx/nest-router#readme","gitHead":"06c2375419211669a154e19656ae068ec2ead846","_id":"@brainfx/nest-router@1.0.9-0.0.0","_nodeVersion":"15.10.0","_npmVersion":"7.5.3","dist":{"integrity":"sha512-btTOdvw4GNoZABu3k0Jc8FjAIC2EEdwViDgSMy/b2ElSJpcrk5IxNmlo43IzyTFIsVIIMA9SmDhQpRCCkEkc9g==","shasum":"f7887c2422b7723aadc578e8a69f8064fd99e1e1","tarball":"https://registry.npmjs.org/@brainfx/nest-router/-/nest-router-1.0.9-0.0.0.tgz","fileCount":104,"unpackedSize":1484209,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNsZQCRA9TVsSAnZWagAA37oP/iyK/0/TTyxY8ruYon8G\nN/nHk/+Y2kORfKSYFQnqGAzRclNyjOpyZuConoBBysWeDuRINykxwWcwy+Jf\nR7LJ9eOyS3DDGx8c6/7peOFcP1UlSS8hBnojLx7a6Pbz2G8y85bEoieEiaZS\nbAgrAsxA5QZsTSHUFJCww7P4XnggZBqYwNRHMF7UQ+ITmVWTS1i4bD9PnarU\nqevKzAOgQRWB1QHDXqWzorDcqJiPUuAggtODtCRtui6AqkyBcY5XTWSPufTL\n0mKwDuwbS85ZYVmxKDjXvBImGCD4srjcCBVR6xOz38itP8lxBFOtMW2Lgr1D\n//QKHe4RFt4tU5ZH3PyiYGYf2u3JwHm+knatacORv0Yp7Xety7zHUl7JZ1aJ\nXzKXy5nBFfR13CZvlOAeFWB+fQGQDTFH9RSrQHPSoxCCqCTyQVEWvVllFxxR\nL+NTg/1hezz/azHjKDVyA06b4YTCmQPCehmfuySrO45D1tmxO0zRgP0Cyb4i\n0aYoNjJ3q4vPUWR841eIYrbOL7FNe13TsYh/FBasLiSAyXIi5nwiKiqR5XE0\nC3ZdhicRl+4lBsZb5A6YkcxxzdPQl52xNCfZNv1fhQOuRGgh0R77AhE7yUCD\nwAbwdOaomMesvhtNNHBj0Z3g6B9dsqLUWrUx3Q7ofI0AlYwCBwDPdD9i8AxN\nHdEc\r\n=LL34\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPZTL+ZMta1b7J4KB00NPTEEQj61DM2URGm2vUmNjRgQIgE7uSjGKfjz8yPIoseLYrp8Xqv1dUZKf9e4XcMmx/gok="}]},"_npmUser":{"name":"anand-k-p","email":"anand@dhruti.ca"},"directories":{},"maintainers":[{"name":"anthony-bfx","email":"anthony.d@brainfx.com"},{"name":"saaniaki","email":"saaniaki@gmail.com"},{"name":"anand-k-p","email":"anand@dhruti.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nest-router_1.0.9-0.0.0_1614202448177_0.7076733078849133"},"_hasShrinkwrap":false}},"time":{"created":"2021-02-23T22:18:08.113Z","1.0.9":"2021-02-23T22:18:08.541Z","modified":"2022-04-04T20:20:55.408Z","1.0.9-0.0.0":"2021-02-24T21:34:08.363Z"},"maintainers":[{"name":"anthony-bfx","email":"anthony.d@brainfx.com"},{"name":"saaniaki","email":"saaniaki@gmail.com"},{"name":"anand-k-p","email":"anand@dhruti.ca"}],"description":"Router Module For Nestjs Framework","homepage":"https://github.com/brainfx/nest-router#readme","keywords":["nestjs","router","addons"],"repository":{"type":"git","url":"git+https://github.com/brainfx/nest-router.git"},"author":{"name":"BrainFx Inc."},"bugs":{"url":"https://github.com/brainfx/nest-router/issues"},"license":"MIT","readme":"# Nest Router\n\n[Forked From: nestjsx/nest-router](https://github.com/nestjsx/nest-router)\n\nRouter Module For [Nestjs](https://github.com/nestjs/nest) Framework\n\n## Quick Overview\n\n`RouterModule` helps you organize your routes and lets you create a routes tree.\n\n### How ?\n\nEvery module can have a path property. That path will be a prefix for all\ncontrollers in the module. If the module has a parent, the will be a child of\nits parent and again all controllers in this child module will be prefixed\nby `parent module's prefix` + `this child module's prefix`\n\n> see issue [#255](https://github.com/nestjs/nest/issues/255) .\n\n## Install\n\nIMPORTANT: you need Nest > v4.5.10+\n\n```bash\nnpm install nest-router --save\n```\n\nOR\n\n```bash\nyarn add nest-router\n```\n\n## Setup\n\nSee how easy it is to set up.\n\n```ts\n... //imports\nconst routes: Routes = [\n  {\n    path: '/ninja',\n    module: NinjaModule,\n    children: [\n      {\n        path: '/cats',\n        module: CatsModule,\n      },\n      {\n        path: '/dogs',\n        module: DogsModule,\n      },\n    ],\n  },\n];\n\n@Module({\n  imports: [\n    RouterModule.forRoutes(routes), // setup the routes\n    CatsModule,\n    DogsModule,\n    NinjaModule\n  ], // as usual, nothing new\n})\nexport class ApplicationModule {\n}\n```\n\n> :+1: TIP: Keep all of your routes in a separate file like `routes.ts`\n\nIn this example, all the controllers in `NinjaModule` will be prefixed\nby `/ninja` and it has two childs, `CatsModule` and `DogsModule`.\n\nWill the controllers of `CatsModule` be prefixed by `/cats`? NO!! :open_mouth:\nThe `CatsModule` is a child of `NinjaModule` so it will be prefixed\nby `/ninja/cats/` instead. And so will `DogsModule`.\n\n> See examples folder for more information.\n\n#### Example Folder Project Structure\n\n```bash\n.\n├── app.module.ts\n├── cats\n│   ├── cats.controller.ts\n│   ├── cats.module.ts\n│   └── ketty.controller.ts\n├── dogs\n│   ├── dogs.controller.ts\n│   ├── dogs.module.ts\n│   └── puppy.controller.ts\n├── main.ts\n└── ninja\n    ├── katana.controller.ts\n    ├── ninja.controller.ts\n    └── ninja.module.ts\n```\n\nAnd here is a simple, nice route tree of `example` folder:\n\n```bash\nninja\n    ├── /\n    ├── /katana\n    ├── cats\n    │   ├── /\n    │   └── /ketty\n    ├── dogs\n        ├── /\n        └── /puppy\n```\n\nNice!\n\n#### Params in nested routes\n\nIn a standard REST API, you probably would need to add some params to your\nnested routes. Here is an example of how you can achieve it:\n\n```ts\n... //imports\nconst routes: Routes = [\n  {\n    path: '/ninja',\n    module: NinjaModule,\n    children: [\n      {\n        path: '/:ninjaId/cats',\n        module: CatsModule,\n      },\n      {\n        path: '/:ninjaId/dogs',\n        module: DogsModule,\n      },\n    ],\n  },\n];\n```\n\nThe `ninjaId` param will be available inside `CatsModule` controllers\nand `DogsModule` controllers. Please, find\nthe [instruction how to handle params in the official documentation](https://docs.nestjs.com/controllers#route-parameters)\n. It might be a good practice to use\na [pipe for transformation use case](https://docs.nestjs.com/pipes#transformation-use-case)\nto have an access to `ninja` object instead of just id.\n\n#### Resolve Full Controller Path:\n\nNestjs dosen't resolve or take into account `MODULE_PATH` metadata when it is\ncoming to resolve Controller path in Middleware resolver for example, so that i\nintroduced a new fancy method `RouterModule#resolvePath` that will resolve the\nfull path of any controller so instead of doing so:\n\n```ts\nconsumer.apply(someMiddleware).forRoutes(SomeController);\n``` \n\nyou should do\n\n```ts\nconsumer.apply(someMiddleware).forRoutes(RouterModule.resolvePath(SomeController));\n``` \n\nsee [#32](https://github.com/shekohex/nest-router/pull/32) for more information\nabout this.\n\n## CHANGELOG\n\nSee [CHANGELOG](CHANGELOG.md) for more information.\n\n## Contributing\n\nYou are welcome to contribute to this project, just open a PR.\n\n## Authors\n\n* **Shady Khalifa** - _Initial work_\n\nSee also the list\nof [contributors](https://github.com/shekohex/nest-router/contributors) who\nparticipated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see\nthe [LICENSE.md](LICENSE.md) file for details.\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fshekohex%2Fnest-router.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fshekohex%2Fnest-router?ref=badge_large)\n","readmeFilename":"README.md"}