Make synchronous queries to a database server in node.js
npm install sync-sql
npm install sync-sql
`
For using the latest version with bug fixes, try the command:
`
npm install cristidraghici/sync-sql
`
Example usage with mysql
`js
var syncSql = require('sync-sql');
var output = syncSql.mysql(
{
host: 'localhost',
user: 'user',
pass: 'password',
database: 'database',
port: '3306'
},
"select * from users"
);
console.log(JSON.stringify(output));
`
Testing
- please edit the .env.example with database information and the sql to test and save the file as .env;
- run npm install;
- run npm run test-mysql;
- run npm run test-pg;
- run npm run test`.