egg-knex-promise
v1.0.6
Published
[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][download-url]
Downloads
3
Readme
egg-knex
knex plugin for egg
Install
$ npm i egg-knex-promise --save
Usage
// {app_root}/config/plugin.js
exports.knex = {
enable: true,
package: 'egg-knex-promise',
};
Configuration
// {app_root}/config/config.default.js
exports.knex = {
client: 'sqlite3',
connection: {
filename: './test.db3',
},
};
see Knex.js for more detail.
Example
// {app_root}/controller/home.js
class HomeController extends Controller {
async index() {
const data = await this.app.knex('user').select('*');
this.ctx.body = data;
}
}
Questions & Suggestions
Please open an issue here.