diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-06-29 00:14:07 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-06-29 00:14:07 +0200 |
| commit | a190d638c608f4352e3f01d72ed419a5ab5129ed (patch) | |
| tree | dd6e7ea24c2ae4b6251f1ae2b609d9017acfd199 /lib/db/bookshelf.js | |
db stuff and initial app scaffold
Diffstat (limited to 'lib/db/bookshelf.js')
| -rw-r--r-- | lib/db/bookshelf.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/db/bookshelf.js b/lib/db/bookshelf.js new file mode 100644 index 0000000..69157cc --- /dev/null +++ b/lib/db/bookshelf.js @@ -0,0 +1,24 @@ +var knex = require('knex')({ + client: 'mysql2', + connection: { + host : process.env.DB_HOST, + user : process.env.DB_USER, + password : process.env.DB_PASS, + database : process.env.DB_NAME, + charset : 'utf8', + typecast : function (field, next) { + console.log(field.type) + if (field.type == 'BLOB') { + return field.string() + } + return next() + } + } +}) + +var bookshelf = require('bookshelf')(knex) + +module.exports = { + bookshelf: bookshelf, + knex: knex, +} |
