{"_id":"@commander-lol/koa-mustache","_rev":"3-cb902d4ae10e0ecb4392369106d5dade","name":"@commander-lol/koa-mustache","description":"Mustache rendering for Koa 2+","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1-beta1":{"name":"@commander-lol/koa-mustache","version":"1.0.1-beta1","description":"Mustache rendering for Koa 2+","main":"index.js","scripts":{"test":"eslint ./**/*.js"},"keywords":["koa","mustache","template","rendering","async"],"author":{"name":"Louis Capitanchik","email":"contact@louiscap.co"},"license":"Apache-2.0","devDependencies":{"@bark/eslint-config":"^0.1.2","eslint":"^4.16.0"},"dependencies":{"fs-jetpack":"^1.2.0","mustache":"^2.3.0"},"gitHead":"a227ab4323772b2cd1412680a3546ed06cea4626","_id":"@commander-lol/koa-mustache@1.0.1-beta1","_npmVersion":"5.5.1","_nodeVersion":"9.2.0","_npmUser":{"name":"commander-lol","email":"contact@louiscap.co"},"dist":{"integrity":"sha512-5qDVkczCOSNN2+NIT8n2bI/34Q2H5u1thlBU3b6v5je9xcrG/1n4REHoLOFkZVBSAGgKGQ2ZZBVxzxegR76tPA==","shasum":"c03ea753b47391988d5b7eeae01fc2aa81118d76","tarball":"https://registry.npmjs.org/@commander-lol/koa-mustache/-/koa-mustache-1.0.1-beta1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAb2j1kx51QIhmgcI9cMIU5eaMZsG1a1PYv0zDazbGNLAiEA2nU8KH1aa8Ynm2GDUN5mgezIUvq0rdAlykyipNAtvP4="}]},"maintainers":[{"name":"commander-lol","email":"contact@louiscap.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/koa-mustache-1.0.1-beta1.tgz_1516579603202_0.41814830037765205"}},"1.0.2":{"name":"@commander-lol/koa-mustache","version":"1.0.2","description":"Mustache rendering for Koa 2+","main":"index.js","scripts":{"test":"eslint ./**/*.js"},"keywords":["koa","mustache","template","rendering","async"],"author":{"name":"Louis Capitanchik","email":"contact@louiscap.co"},"license":"Apache-2.0","devDependencies":{"@bark/eslint-config":"^0.1.2","eslint":"^4.16.0"},"dependencies":{"fs-jetpack":"^1.2.0","mustache":"^2.3.0"},"gitHead":"a227ab4323772b2cd1412680a3546ed06cea4626","_id":"@commander-lol/koa-mustache@1.0.2","_npmVersion":"5.5.1","_nodeVersion":"9.2.0","_npmUser":{"name":"commander-lol","email":"contact@louiscap.co"},"dist":{"integrity":"sha512-lVELPr/OgSm9kR9VVQbFfGHSRuHbaa438HE/CdkOIAgUaqwrZOP+Y1jMeiyq104fq3oVuiQ0DqNr8scsPleBsw==","shasum":"c0b34c8f7288134fcf0b0213ed63769ffe8208b9","tarball":"https://registry.npmjs.org/@commander-lol/koa-mustache/-/koa-mustache-1.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICzJvIwcYEJaw7gu2m83ezM0kRd/tTSdLCuqm2Qdz35GAiAfkOLDPyMIDhTLgxK6EyQ1lG8jSK+vmhGYFv57R2/BOw=="}]},"maintainers":[{"name":"commander-lol","email":"contact@louiscap.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/koa-mustache-1.0.2.tgz_1516579629651_0.9425887851975858"}},"1.0.3":{"name":"@commander-lol/koa-mustache","version":"1.0.3","description":"Mustache rendering for Koa 2+","main":"index.js","scripts":{"test":"eslint ./**/*.js"},"keywords":["koa","mustache","template","rendering","async"],"author":{"name":"Louis Capitanchik","email":"contact@louiscap.co"},"license":"Apache-2.0","devDependencies":{"@bark/eslint-config":"^0.1.2","eslint":"^4.16.0"},"dependencies":{"fs-jetpack":"^1.2.0","mustache":"^2.3.0"},"gitHead":"e816399ce871fc668a923969495c8f6f35456f77","_id":"@commander-lol/koa-mustache@1.0.3","_npmVersion":"5.5.1","_nodeVersion":"9.2.0","_npmUser":{"name":"commander-lol","email":"contact@louiscap.co"},"dist":{"integrity":"sha512-5EUQRrKfL0bhi/7AWiBvqd6chjgKh4tiE4Pnkw5R4qYm/5xCMo3X1iYhJvpMZAjFEw0levu8NVC+N1QQDxcu6w==","shasum":"39e08d705288cc873311cd812cfe3a2369ff777a","tarball":"https://registry.npmjs.org/@commander-lol/koa-mustache/-/koa-mustache-1.0.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCE9fv+L0kVcmLPl3l1Ylk57A1lHuEUSE4/Bq52XtOr3QIgOmJj800YXYE86GFIY7OperakYOjcXRa0dLRm9w0V1zw="}]},"maintainers":[{"name":"commander-lol","email":"contact@louiscap.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/koa-mustache-1.0.3.tgz_1516582328085_0.43979849060997367"}}},"readme":"# koa-mustache\nMustache template rendering for Koa 2+\n\n## Installation\n\n`npm i --save @commander-lol/koa-mustache`\n\n## Example\n\n```js\nconst path = require('path')\nconst Koa = require('koa')\nconst mustache = require('@commander-lol/koa-mustache')\n\nconst app = new Koa()\n\nconst templatePath = path.join(__dirname, 'views')\napp.use(mustache(templatePath))\n\n// Respond to all requests with the template at `./views/index.mustache`\napp.use(async ctx => {\n  await ctx.render('index')\n})\n\n```\n\n## Usage\n- Require the module `const mustache = require('@commander-lol/koa-middleware')`\n- Call the function to configure the middleware `const middleware = mustache(myTemplateDirectoryPath, myOpts)`\n- Mount the middleware on your app `app.use(middleware)`\n- The `ctx.render` function has been added to all subsequent middleware (including routes when using routers). \n`await` this function to render the specified params to the ctx body. If the template is not found, the status\nwill be set to 404. If the template path is not a regular file, the status will be set to 500. \n\n## Types\n\nThese are the types that you need to be aware of to use `koa-mustache`. The export of this module\n(the object imported by `require('@commander-lol/koa-mustache')`) is of the type `ConfigureMiddleware`.\n\n**Configuration Options**\n```jsx\ntype Options = {\n  debug(...args: any[]): void,\n  useCache?: boolean,\n  extension?: string,\n  partials?: string,\n}\n```\n\n**Module Export**\n```jsx\ntype ConfigureMiddleware = (root: string, opts?: Options): KoaMiddleware\n```\n\n**Render Function**\n```jsx\ntype RenderTemplate = (template: string, data: Object): Promise<void>\n```\n\n## Options\n\nname | type | default | notes\n-----|------|---------|------\ndebug|`Function`|noop|Will receive debug information. Typically printed with `console.log`, but could be sent elsewhere\nuseCache|`boolean`|if `NODE_ENV` is equal to `production`, true otherwise false|Will load templates on server boot, and exclusively use the in-memory cache for retrieving templates to render. Partials will always be loaded on boot\nextension|`string`|`.mustache`|The file extension to use when loading templates (Must include leading dot)\npartials|`string`|`partials`|The path, relative to the middleware root, where partials are located\n\n","maintainers":[{"name":"commander-lol","email":"contact@louiscap.co"}],"time":{"modified":"2022-04-05T00:24:44.509Z","created":"2018-01-22T00:06:43.269Z","1.0.1-beta1":"2018-01-22T00:06:43.269Z","1.0.2":"2018-01-22T00:07:10.595Z","1.0.3":"2018-01-22T00:52:08.315Z"},"keywords":["koa","mustache","template","rendering","async"],"author":{"name":"Louis Capitanchik","email":"contact@louiscap.co"},"license":"Apache-2.0","readmeFilename":"README.md"}