0.1.0 • Published 6 years ago

egg-view-lambda v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

egg-view-lambda

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-view-lambda --save

Usage

// {app_root}/config/plugin.js
exports.lambda = {
  enable: true,
  package: 'egg-view-lambda'
}

// {app_root}/config/config.default.js
exports.view = {
  mapping: {
    '.js': 'lambda'
  }
}

Create a view file

// app/view/hello.js
module.exports = locals => ({
  hello: locals.name
})

Render it

// app/controller/render.js
exports.render = async ctx => {
  await ctx.render('hello.js', {
    name: 'world'
  })
}

Configuration

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT