@iridium/use-knex

0.0.2 • Public • Published

Use-knex

Usage:

const knex = require('@iridium/use-knex');
const config = {
  client: 'mysql',
  connection: {
    host : '127.0.0.1',
    user : 'your_database_user',
    password : 'your_database_password',
    database : 'myapp_test'
  }
};

const useKnex = knex(config)

// function serverless
module.exports = useKnex(async (req, res) => {
  const users = await req
    .db
    .select('*')
    .from('users'); // <- Thanks to use-knex;

  res.end();
})

License

MIT © David Bernal

/@iridium/use-knex/

    Package Sidebar

    Install

    npm i @iridium/use-knex

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    2.22 kB

    Total Files

    4

    Last publish

    Collaborators

    • davidbernal