@iridium/use-knex

v0.0.2
Use knex with now.sh
now.sh

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

npm i @iridium/use-knex

Metadata

  • MIT
  • Whatever
  • David Bernal
  • released 12/28/2018

Downloads

Maintainers