{"_id":"@beautinique/backend-response","_rev":"8-3b030bf1c3f68f8360ef1b7dddccc337","name":"@beautinique/backend-response","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"@beautinique/backend-response","version":"1.0.0","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.0","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"2790ab98df90ed133eb8ef67872fb37ec45414b6","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.0.tgz","fileCount":9,"integrity":"sha512-PI99j5B51Xyz6HEiqjQrYY35bRHam+JuQbLqAsmDDGaQ/2gsPis5FrdrmCdZRBAEku7MLncWMHCcF3sGEJ4ywg==","signatures":[{"sig":"MEUCIFoDS4cMggexA8F+0WiQrLtjfQ89feAjRri2v/EsoE8YAiEA5RoWppYsQsVxDPblvz0MQBYqSxa5v/3yZVcBfhUdgoA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69463},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"c257205d3ff27ac62f8ee8bbfd6e3f8ae3cd772e","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.10.1","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.0","@beautinique/backend-classes":"^1.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.0_1783686769684_0.1726998623443834","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@beautinique/backend-response","version":"1.0.1","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.1","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"e6fd25048f4bb5ef781df1052476c0a58585cabc","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.1.tgz","fileCount":9,"integrity":"sha512-uo8CSYPxdZvaYan0g4UnZ+67gwDI1dPrqWwiXkOScjLrzh+JjbwgtjUaS4XktfOL1nFH4Ukm8EUvLoZ7VqiLvA==","signatures":[{"sig":"MEUCIQDnusaEc3cpKaSS+4j00W1pQE+w02U/G3KBo6qvaCa1YQIgE+4T3z/Nc1vqi4VjNMFIdee2RkduDvmtWUz62cuEaq8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69591},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"f87fbc40990ac15421d93a5045675d85419a050a","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.10.1","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.0","@beautinique/backend-classes":"^1.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.1_1783689838364_0.5687568615187661","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@beautinique/backend-response","version":"1.0.2","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.2","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"9ff4680d8ee7bf0773606a083a25a28c6bc6ea72","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.2.tgz","fileCount":9,"integrity":"sha512-f//9RkUMFKfmarAkrgLM2pBpe0YPSQdZqX66UWu4XcArgquFNqMC/ExzlhmdMVerOl4/qUcZrn0pBfoZeU4ugw==","signatures":[{"sig":"MEQCIDEuZ/k68gTvVMoT9mwL/y9lXXATukkMYLfXt/meTVraAiBcrGQsREWy3UR5jNf+fM7RYd07I2wuHBKRIxzS0p44cQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69805},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"2aefc5229ad24f8c4b0721c171c04ad661beb831","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.10.1","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.0","@beautinique/backend-classes":"^1.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.2_1783793212521_0.7575890353145851","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@beautinique/backend-response","version":"1.0.3","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.3","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"2eb1ce0f6d49aebc35c5cecc135c605cadef53aa","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.3.tgz","fileCount":31,"integrity":"sha512-Bscu5rdM3owbsDwLz2bMUeDwvTHN48U1xdYW216Uqw55CaSgGdH3lCGLj2yLKhn+gUkGTwjIyWcCPIpfqvUd7A==","signatures":[{"sig":"MEYCIQCOOy9FdyIZCdzShtMSK9vHiC8DkgAdBcr+M5o55aSB4AIhALs/7HAnLSiCNflmzq1qbyQ9WDXUJWRGtSTWzAJGlOrd","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76473},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"309063216b8eafe33d6f8bb794e6ee6b96aedb9d","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","postbuild":"node ../../../scripts/build-types/index.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.8.0","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.4","@beautinique/backend-classes":"^1.0.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.3_1784656560961_0.5612892564924259","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@beautinique/backend-response","version":"1.0.4","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.4","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"4e624df4a48efe3712027c618cdea4a8ff430598","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.4.tgz","fileCount":31,"integrity":"sha512-SQIvwKy8ZgmzEZicVZPXG2eU7BjWMyyNnTiYA31RXxYPbNv5/jA5eszX8KL+m9Pc7B694SWZSehE7/u6D48/Vw==","signatures":[{"sig":"MEUCIDQslgwPgor9pP8vfKmMPPCIuWkp4BdbhcUzi55OzwlWAiEA3zup1GhcVlQI3ElKU0ZPTB5B6lrbO6cDEe/Fjxp1jNo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76473},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"e30737149d6d3916e61a909d2a30954882a1ce7e","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","postbuild":"node ../../../scripts/build-types/index.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.8.0","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.6","@beautinique/backend-classes":"^1.0.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.4_1785442905005_0.5402885916892988","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@beautinique/backend-response","version":"1.0.5","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.5","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"686994be6e5ec53f1cd594d23cb807ec39c6eba3","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.5.tgz","fileCount":31,"integrity":"sha512-9FlCWPg08o8tASX7NUyUPXLOLgEP+IsylJbpTJbnYtXpvUE+4t3M1Ped049PxI7+C8ynTlq9LVUGfzzgAkrtbg==","signatures":[{"sig":"MEUCIQCyd+mXIy1KtA4mWuQC4yfPhAyORuH24H2b6cvGtRlWlQIgcz0wFRTwYd09JogXTiK/6RYqnDbnUufrkILzFKevZWY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77557},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"b026a3b9693c94e58dcd163010dbf39b6b79e7ea","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","postbuild":"node ../../../scripts/build-types/index.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.8.0","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.7","@beautinique/backend-classes":"^1.0.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.5_1787039399059_0.41091648504721934","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@beautinique/backend-response","version":"1.0.6","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","_id":"@beautinique/backend-response@1.0.6","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"dist":{"shasum":"96df4eaee150e9fa02d68ab971635cf81f5cdfd7","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.6.tgz","fileCount":31,"integrity":"sha512-BK6lHEWtkcwJY2I3784/Mlz9Pdi5hEopkpZw7QxER2fL0mfjN+GvspFhlq96SRARxTUgG8uFXaWGTd/yHGmcRQ==","signatures":[{"sig":"MEUCIAoFOZLJiR0x7iKMJPie5fATSi7eJSWF6bHHWKhnlkLjAiEAytsJubtcK03uGhUnYkEzJHDnc2v7qmaKEnO/CsVwBCc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77557},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"2807c53a8d389b6f0a36770b416bcc2026e40ca2","scripts":{"dev":"tsup --watch","lint":"eslint .","build":"tsup","postbuild":"node ../../../scripts/build-types/index.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"repository":{"url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","type":"git","directory":"packages/backend/response"},"_npmVersion":"11.10.1","description":"Backend Request middleware for Beautinique project.","directories":{},"sideEffects":["./src/globals.ts"],"_nodeVersion":"24.13.1","dependencies":{"@beautinique/backend-utils":"^1.0.8","@beautinique/backend-classes":"^1.0.6"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/express":"^5.0.6"},"peerDependencies":{"express":"^5.2.1"},"_npmOperationalInternal":{"tmp":"tmp/backend-response_1.0.6_1787219482431_0.3901059068807513","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@beautinique/backend-response","version":"1.0.7","description":"Backend Request middleware for Beautinique project.","keywords":["backend","response","middleware","express","mongoose","beautinique"],"author":{"name":"Nageshwar Pawar"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","directory":"packages/backend/response"},"bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","sideEffects":["./src/globals.ts"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs","default":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"build":"tsup","postbuild":"node ../../../scripts/build-types/index.mjs","dev":"tsup --watch","lint":"eslint .","typecheck":"tsc --noEmit"},"publishConfig":{"access":"public"},"engines":{"node":">=24"},"devDependencies":{"@types/express":"^5.0.6","typescript":"^6.0.3"},"dependencies":{"@beautinique/backend-classes":"^1.0.7","@beautinique/backend-utils":"^1.0.9"},"peerDependencies":{"express":"^5.2.1"},"gitHead":"3a5103fb9030969e849b1e69b02bbe7d1cab5fbe","_id":"@beautinique/backend-response@1.0.7","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-ZK+LEnVg2WDe960D6GHdmRaNwskK9rhkXkmKripv8KnfWllEqYyGz66GkDSv6YkBplmI39F18tUI8v1qo+IVFA==","shasum":"2956af3fc440a5a6794bf81a2396dac8307920b4","tarball":"https://registry.npmjs.org/@beautinique/backend-response/-/backend-response-1.0.7.tgz","fileCount":31,"unpackedSize":77557,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFGgJj/XVUkTw+nwnJixCP9l7nrE9X3TsOHwiOSCQqnUAiEAgvQiDN+Qk8+eDclbWj5Knn2YwHiVvB6xr2EqYK8rT+A="}]},"_npmUser":{"name":"beautinique","email":"beautinique.bq@gmail.com"},"directories":{},"maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/backend-response_1.0.7_1787576780349_0.26906105430230265"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-10T12:32:49.550Z","modified":"2026-08-24T13:06:20.671Z","1.0.0":"2026-07-10T12:32:49.843Z","1.0.1":"2026-07-10T13:23:58.499Z","1.0.2":"2026-07-11T18:06:52.831Z","1.0.3":"2026-07-21T17:56:01.122Z","1.0.4":"2026-07-30T20:21:45.150Z","1.0.5":"2026-08-18T07:49:59.195Z","1.0.6":"2026-08-20T09:51:22.593Z","1.0.7":"2026-08-24T13:06:20.511Z"},"bugs":{"url":"https://github.com/Nageshwar1997/BQ-Packages/issues"},"author":{"name":"Nageshwar Pawar"},"license":"MIT","homepage":"https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/backend/response#readme","keywords":["backend","response","middleware","express","mongoose","beautinique"],"repository":{"type":"git","url":"git+https://github.com/Nageshwar1997/BQ-Packages.git","directory":"packages/backend/response"},"description":"Backend Request middleware for Beautinique project.","maintainers":[{"name":"beautinique","email":"beautinique.bq@gmail.com"}],"readme":"# @beautinique/backend-response\r\n\r\nConsistent Express response handling for Beautinique backend services - a JSON success envelope, centralized error handling, a branded 404, and an async route wrapper.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @beautinique/backend-response\r\n```\r\n\r\n`express` is a peer dependency - install whichever version your service already uses.\r\n\r\n## Wiring it together\r\n\r\n```ts\r\nimport { errorResponse, notFoundResponse, successResponse, tryCatch } from '@beautinique/backend-response';\r\n\r\napp.use(successResponse()); // near the top, before routes\r\n\r\napp.use('/api', routes); // routes use tryCatch(...) internally\r\n\r\napp.use(notFoundResponse({ serveHtml: true })); // after routes\r\napp.use(errorResponse()); // last\r\n```\r\n\r\n## `successResponse`\r\n\r\nAttaches `res.success(...)` - a consistent `{ success: true, message, data? }` JSON response helper - to every request, so route handlers don't have to hand-build that envelope themselves.\r\n\r\n```ts\r\napp.use(successResponse());\r\n\r\napp.get(\r\n  '/users/:id',\r\n  tryCatch(async (req, res) => {\r\n    const user = await userService.findById(req.params.id);\r\n    res.success({ data: user, message: 'User fetched' });\r\n  }),\r\n);\r\n```\r\n\r\n| Option           | Default   | Description                                                          |\r\n| ----------------- | --------- | ---------------------------------------------------------------------- |\r\n| `defaultMessage`  | `Success` | Used whenever a `res.success(...)` call doesn't provide its own.     |\r\n\r\n`data` is omitted from the JSON body entirely when not provided, rather than being sent as `null`/`undefined`.\r\n\r\n## `tryCatch`\r\n\r\nWraps an async Express route handler so any thrown/rejected error is forwarded to `next(error)` instead of crashing the process or hanging the request, and gives the handler three deferred lifecycle hooks via `res.locals`:\r\n\r\n- `res.locals.afterResponse` - run after the handler resolves successfully.\r\n- `res.locals.afterRollback` - run if the handler throws/rejects.\r\n- `res.locals.afterFinish` - always run once the HTTP response has fully finished sending.\r\n\r\n```ts\r\napp.post(\r\n  '/orders',\r\n  tryCatch(async (req, res) => {\r\n    const order = await orderService.create(req.body);\r\n\r\n    res.locals.afterResponse?.push(async () => {\r\n      await notifyWarehouse(order.id);\r\n    });\r\n\r\n    res.success({ data: order, statusCode: 201 });\r\n  }),\r\n);\r\n```\r\n\r\nExpress-only, no database/session dependency - safe to use in any service, including one with no database at all (e.g. an API gateway).\r\n\r\n## `notFoundResponse`\r\n\r\nCatch-all for requests that matched no route. Register it after every route, but before `errorResponse` - it turns \"nothing else handled this request\" into a `NotFoundError` and forwards it via `next(error)`, so it flows through the same error path as everything else.\r\n\r\n```ts\r\napp.use(notFoundResponse({ serveHtml: true }));\r\n```\r\n\r\n| Option      | Default                                    | Description                                                                                                            |\r\n| ----------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |\r\n| `message`   | `(req) => \\`Cannot ${req.method} ${req.originalUrl}\\`` | Builds the `NotFoundError` message. Only used when `serveHtml` is off, or the request doesn't look like a browser navigation. |\r\n| `serveHtml` | `false`                                     | Serve Beautinique's branded HTML 404 page for requests that look like a real browser navigation (an `Accept` header that explicitly includes `text/html`). JSON API clients still get the usual `NotFoundError` → `errorResponse` flow. |\r\n\r\n## `errorResponse`\r\n\r\nThe app's centralized error-handling middleware. Register it LAST, after every route and other middleware - Express only recognizes a 4-argument function as error-handling middleware, and only errors that reach the end of the chain (e.g. via `next(error)`, as `tryCatch`/`checkEmptyRequest`/`serviceAccess` all do) end up here.\r\n\r\n```ts\r\napp.use(errorResponse());\r\n```\r\n\r\nSends a `{ success: false, code, message, fieldErrors?, globalErrors? }` JSON response, using the thrown error's own `statusCode`/`code`/`message`/`fieldErrors`/`globalErrors` when it's a trusted operational `AppError` - otherwise a generic 500, never leaking the real error's message to the client.\r\n\r\n| Option         | Default                         | Description                                                                                          |\r\n| -------------- | -------------------------------- | -------------------------------------------------------------------------------------------------- |\r\n| `includeStack` | `process.env.IS_DEV === 'true'` | Include the underlying error's stack trace in the JSON response. Must stay off in production. |\r\n\r\n## Repository\r\n\r\nhttps://github.com/Nageshwar1997/BQ-Packages\r\n\r\n## Homepage\r\n\r\nhttps://github.com/Nageshwar1997/BQ-Packages\r\n\r\n## Issues\r\n\r\nhttps://github.com/Nageshwar1997/BQ-Packages/issues\r\n\r\n## Author\r\n\r\nNageshwar Pawar\r\n\r\n## License\r\n\r\nThis package is licensed under the MIT License. See the root `LICENSE` file for details.\r\n","readmeFilename":"README.md"}