egg-view-lambda

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i egg-view-lambda

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

7.58 kB

Total Files

7

Last publish

Collaborators

  • legendecas