{"_id":"@101-ways/core-express","name":"@101-ways/core-express","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@101-ways/core-express","description":"Accelerator Express package","version":"0.1.0","main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"express":"^4.19.2","tctx":"^0.2.0","tslib":"^2.6.2","@101-ways/core":"^0.2.0"},"devDependencies":{"@types/express":"^4.17.21","undici":"^6.15.0"},"scripts":{"build":"make","test":"make test"},"_id":"@101-ways/core-express@0.1.0","_integrity":"sha512-CAsXSXra8ILlbLYB0brnYlrSpQfC1nicpwzcQMJ6sS0cnV+8ncC7KABo2Hjy27bi4AZC5js26ktSCNJ9cJoDhw==","_resolved":"/tmp/18de69d14fd7159a1ee7a2e4c9b8ea8c/101-ways-core-express-0.1.0.tgz","_from":"file:101-ways-core-express-0.1.0.tgz","_nodeVersion":"18.20.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-CAsXSXra8ILlbLYB0brnYlrSpQfC1nicpwzcQMJ6sS0cnV+8ncC7KABo2Hjy27bi4AZC5js26ktSCNJ9cJoDhw==","shasum":"dd2961492f751758f623e1c3e103bfbef0ae61b2","tarball":"https://registry.npmjs.org/@101-ways/core-express/-/core-express-0.1.0.tgz","fileCount":38,"unpackedSize":21949,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjovkacOkIuY7R3zPfBPCooVxAgTiUyIvjUKQbtHpg2AIhAICuKIiGDA4mO4SkR26hG1jaQocXwSlU6tv6XvqaIK6M"}]},"_npmUser":{"name":"borisovg","email":"git@gir.me.uk"},"directories":{},"maintainers":[{"name":"borisovg","email":"git@gir.me.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/core-express_0.1.0_1714486985976_0.54005374637022"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-30T14:23:05.839Z","0.1.0":"2024-04-30T14:23:06.113Z","modified":"2024-04-30T14:23:06.483Z"},"maintainers":[{"name":"borisovg","email":"git@gir.me.uk"}],"description":"Accelerator Express package","readme":"# @101-ways/core-express\n\n[Express](https://expressjs.com/) server accelerator package. It uses the Service Registry pattern to create a single object with APIs.\n\n## Features\n\n- starts server on port 8000 by default\n- request / response logging with tracing metadata\n- [asynchronous context](https://nodejs.org/api/async_context.html) within request flow\n\n## Usage\n\n```ts\nimport { load } from '@101-ways/core-express';\n\nload([`${__dirname}/modules`]).then((sr) => {\n  sr.express.app.get('/hello', (req, res) => {\n    res.json({ result: 'hello world' });\n  });\n});\n```\n\nBasic example for creating a child package:\n\n```ts\nimport { load as loadCore, type Registry } from '@101-ways/express';\n\nexport type { Registry };\n\nexport async function load<T extends Registry>(paths: string[] = [], sr?: T) {\n  return loadCore([`${__dirname}/modules`, ...paths], sr);\n}\n```\n\n## Service Registry API\n\nEverything in [@101-ways/core](../core/README.md) and\n\n- sr.config - configuration (see [./src/modules/config.ts](./src/modules/config.ts))\n- sr.express - Express module methods\n  - sr.express.app - Express app (see https://expressjs.com/en/4x/api.html#app)\n  - sr.express.returnError(req, res, err, code?) - helper function to log and return an error\n  - sr.express.server - HTTP server used by the app (see https://nodejs.org/api/http.html#class-httpserver)\n\n## Environment Variables\n\nEverything in [@101-ways/core](../core/README.md) and\n\n- PORT='8000' - HTTP server port\n","readmeFilename":"README.md"}