How to do it…

In order to access a MariaDB database, we will install the mariasql package from https://github.com/mscdex/node-mariasql and then promisify its .query() method, to work in an easier fashion. Installation is accomplished with npm install mariasql --save and, after a short while (you will see some object code being built), the package will be installed. Follow the steps mentioned next.

Another possibility would be to use mariasql-promise from https://github.com/steelbrain/mariasql-promise, all of whose methods already return promises. However, getting the connection object and storing it for later use is harder with this library, and that's why I opted for the original one; after all, we only need to modify .query() to return a promise.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.226.105