{"_id":"@botorjs/cord","_rev":"1-ec5264ac6a307ecb5b86872f6086471e","name":"@botorjs/cord","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@botorjs/cord","version":"0.0.1","description":"Library that core of Botorjs is connect component","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","test":"mocha -r ts-node/register tests/**/*.test.ts","coverage":"nyc -r lcov -e .ts -x \"*.test.ts\" mocha -r ts-node/register tests/**/*.test.ts && nyc report","coverage-ci":"nyc -r lcov -e .ts -x \"*.test.ts\" mocha -r ts-node/register tests/**/*.test.ts && nyc report --reporter=text-lcov | coveralls"},"repository":{"type":"git","url":"git+https://github.com/botorjs/cord.git"},"keywords":["botorjs","botor","core","cord","node","typescript","framework"],"author":{"name":"noton"},"license":"MIT","bugs":{"url":"https://github.com/botorjs/cord/issues"},"homepage":"https://github.com/botorjs/cord#readme","dependencies":{"@botorjs/boot":"0.0.1","@types/dotenv":"^6.1.0","@types/lodash":"^4.14.122","dotenv":"^6.2.0","lodash":"^4.17.11"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.2","@types/mocha":"^5.2.6","@types/node":"^11.10.4","chai":"^4.2.0","coveralls":"^3.0.3","debug":"^4.1.1","mocha":"^6.0.2","nyc":"^13.3.0","ts-node":"^8.0.2","typescript":"^3.3.3333"},"gitHead":"cecdc4f0ee10a99c5b13b8eb30a370bf06d72ada","_id":"@botorjs/cord@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.2","_npmUser":{"name":"nortonperson","email":"norton0395@gmail.com"},"dist":{"integrity":"sha512-CjBU/MBXpHq7f1zKBECBwa+OHVLYMzrAl9sm86EjLpKIDr9I4GaSi+/dJvUlmT8TxX9AQNrYYmhDCGCuDfM8xQ==","shasum":"9ba2d064c91ab68e5146e70a3894377966536992","tarball":"https://registry.npmjs.org/@botorjs/cord/-/cord-0.0.1.tgz","fileCount":13,"unpackedSize":22877,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcgJWZCRA9TVsSAnZWagAA4HEP/2lxN6ZaDmrgdNjjydH1\n9SahDwPn4AilNyjzaq14+F6Xr8MsL2bahtuiXXJzIVWye5FYYaCWp4+UE6Yw\nVTQ3U5i8q4vlN3+WPSK+VZdp7DW7dYtnnRfuQqxN2BQNi80ydKAtBiryHeqL\n+1/64hQ90+4EeRNxCblOh78dHXq6hZAg8pWNJxmYHS2zp4j2hc2//PVf6Zo7\n9VgZA06hkF4BitYF2yZyL/Ds0OzON/cbdx1Wom3tx13ATGOl2Xz7h+QXLoPy\nmkwunPsBKJ2qfasX5Qy54AI37O6z/vc9SDImUdmOKWnd5jeSIu/b79beHk7M\nqcqSnD7dcD5+y+kBerIT34jMVavOMXZ0klyMRLrxBq67sB661O+6BuZmwrpE\n8rQS3Mo34JxicqZjZIiOE+ZFRHH2IOmRAlp9Cm/ZiRq9EZ91ykrt0r6RQGGk\nAqa+JElGU2Fk1j5gzplAMgJiLIko1Fi/qMss6tCH3s1QsslKoZDN62DcsN1d\n6+sgvbwc+mRyCWu9pqnzVr1H7zSaoRHxfiJBrwDUDzSOlS1k3DaEgdlsRsqH\nAx2FaKK/w27mfuSiAPBPPXSNfIO5rXTCy9SNB3oD9s2R0mtnB3hqMxRP+Pv8\nl/JFaOBgMWUCWMNwvReIfphdib7bad1cqTv3j1S/qY8W+Od9R7lTppyrdQBP\nyH+Y\r\n=PRIo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE/v8Hd1SIaYHVGnxIJJgIPl2k/ilaIPx3+zjbKfVLCEAiAtS+3Jh6kgERrRA7AGS0LxKtMsUDP+pcFWgL+gHaDFxA=="}]},"maintainers":[{"name":"nortonperson","email":"norton0395@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cord_0.0.1_1551930777188_0.12822839489618643"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-07T03:52:57.010Z","0.0.1":"2019-03-07T03:52:57.399Z","modified":"2022-04-04T20:14:26.155Z"},"maintainers":[{"name":"nortonperson","email":"norton0395@gmail.com"}],"description":"Library that core of Botorjs is connect component","homepage":"https://github.com/botorjs/cord#readme","keywords":["botorjs","botor","core","cord","node","typescript","framework"],"repository":{"type":"git","url":"git+https://github.com/botorjs/cord.git"},"author":{"name":"noton"},"bugs":{"url":"https://github.com/botorjs/cord/issues"},"license":"MIT","readme":"# Cord\n[![Build Status](https://travis-ci.org/botorjs/cord.svg?branch=master)](https://travis-ci.org/botorjs/cord)\n[![Coverage Status](https://coveralls.io/repos/github/botorjs/cord/badge.svg?branch=master)](https://coveralls.io/github/botorjs/cord?branch=master)\n\n### Library that core of Botorjs is connect component using [Boot](https://github.com/botorjs/boot)\n\n# Installation\n```\nnpm install @botorjs/cord --save\n```\n\n# Setup and Example\n\n* Folder\n```\nproject\n└───services\n│   │   Service.ts\n└───providers\n│   │   ProviderTest.ts\n└───start\n│   │   app.ts\n|\n│   .env\n|   index.ts\n```\n\n* Service.ts\n```js\n\n    export class ServiceTest {\n        private _count: number;\n\n        constructor() {\n            this._count = 0;\n        }\n\n        public get count(): number {\n            return this._count\n        }\n\n        public inc() {\n            this._count++;\n        }\n\n        public sub() {\n            this._count--;\n        }\n    }\n\n```\n\n* ProviderTest.ts\n```js\n\n    import { ServiceProvider, Boot } from '@botorjs/boot';\n    import { ServiceTest } from '../services/Service';\n\n    export class ProviderTest extends ServiceProvider {\n        \n        register(app: Boot) {\n            app.ioc.singleton(ServiceTest.name, ServiceTest)\n            app.alias.add(\"service\", ServiceTest);\n        }\n\n        boot(app: Boot) {\n            const service = app.ioc.get<ServiceTest>(ServiceTest);\n            service.inc();\n        }\n    }\n\n```\n\n* app.ts\n```js\n    import { App } from '@botorjs/cord';\n    import { ProviderTest } from '../providers/ProviderTest';\n\n    const app: App = {\n        providers: [\n            ProviderTest\n        ],\n        aliases: {\n            \"APP_PATH\": \"ROOT\",\n        },\n    }\n    export = app;\n\n```\n\n* .env\n```\n    TEST_ENV=test\n```\n\n* index.ts\n```js\n\n    import { App, Cord } from '@botorjs/cord';\n\n\n    var cord: Cord = new Cord();\n\n    cord.boot.hook.on(\"start\", () => {\n        console.log(\"start work\");\n    })\n\n    cord.root(__dirname)\n        .preload()\n        .fire();\n\n    var service =  cord.boot.get<ServiceTest>(ServiceTest);\n    expect(service.count).to.eql(1);\n    service.sub();\n    expect(service.count).to.eql(0);\n\n    var env: Env = cord.boot.get<Env>(Env);\n    var val =  env.get(\"TEST_ENV\");\n    expect(val).to.eql(\"test\");\n```\n\n# API\n\n## Cord\n* Cord is backgroud connect to component\n\n| Property   |      Description      |\n|---------- |:-------------|\n| config  |  get config cord | \n| boot |    get Boot   | \n| root(folder) | set folder root of appliction | \n| preload() | Preload application, it will load the ServiceProvider to Boot and load Alisa to boot. Load environment and file .env (defaul config) to Env and add to IoC of Boot |\n| fire | call event to system notification start application |\n\n## Env\n* load config in file `.env`(default) to environment and get set environment\n\n| Property   |      Description      |\n|---------- |:-------------|\n| get  |  get value environment | \n| set |   set value environment  | \n\n## ConfigCord\n* load config in file `.env`(default) to environment and get set environment\n\n| Property   |      Description      | Defaul |\n|---------- |:-------------|------|\n| start_folder  |  Folder the file start is config input of component | \"start\"  |\n| app_file |   sFile config provider of Boot  | \"app.ts\" |\n| root |   Root folder of application  |  null |\n| env_file |   File environment of application  | \".env\" |\n\n## App\n* Config default of App\n\n| Property   |      Description      |\n|---------- |:-------------|\n| providers  |  the ServiceProvider of Boot | \n| aliases |   the alias of Boot | \n","readmeFilename":"README.md"}