0.1.0 • Published 6 years ago
egg-view-lambda v0.1.0
egg-view-lambda
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
0.1.0
6 years ago