MySQL js (https://github.com/mysqljs/mysql)
$ npm install mysql
or
$ npm install mysqljs/mysql
Dotenv (https://github.com/motdotla/dotenv)
$ npm install dotenv --save
Create .env file like or add lines to your .env file;
DB_HOST=your_db_host
DB_USER=your_db_username
DB_PASSWORD=your_db_password
DB_DATABASE=your_db_database_name
npm i node-mysql-queries
res = controller response table_name = string (table name)
selectAllSQL(res, 'table_name')
res = controller response table_name = string (table name) columns = string array (columns name) You can use multiple column like ['col1', 'col2'] values = array (values) You can use multiple value like [1, 'val2']
selectWhereSQL(res, 'table_name', ['column_name'], [values])
res = controller response table_name = string (table name) value = object for example: {id: 1, title: 'Hello World'}
insertSQL(res, 'table_name', {value})
res = controller response table = string (table name) columns = string array (columns name) You can use multiple column like ['col1', 'col2'] values = array (values) You can use multiple value like [1, 'val2'] where = string like (id = 1)
updateSQL(res, 'table', ['columns'], [values], 'where')
res = controller response table_name = string (table name) column = string (column name) value = string (value)
deleteSQL(res, 'table_name', 'column', 'value')
You can read and follow our CONTRIBUTING.md and report it using GitHub Issues! for reporting bugs, suggesting enhancements, bugfixes, new features and extras are welcome.
Thanks goes to these wonderful people (emoji key):
Yağız Mehmet Demir 🚇 💻 🐛 📖 💡 🚧 |
This project follows the all-contributors specification. Contributions of any kind welcome!