1.1.0 • Published 4 years ago

@tigojs/lambda-mysql v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

@tigojs/lambda-mysql

Provide mysql connection ability for tigo lambda.

Usage

Install by npm or @tigojs/cli.

npm install @tigojs/lambda-mysql
# or
tigo add lambda-mysql

Then in your lambda, you can connect to your mysql database like this:

const mysql = require('@tigojs/mysql');

addEventListener('request', (event) => {
  // create connection
  const conn = mysql.createConnection({
    host: SCRIPT_ENV.host,  // we recommend to use environment KV to store your credential
    password: SCRIPT_ENV.password,
    database: SCRIPT_ENV.database,
  });
});

For more details, see documentation of mysql2.

Note: this package is using mysql2/promise, not the default version.

License

MIT

1.1.0

4 years ago

1.0.0

4 years ago