Can I have all my SQL statements stored in a different ( .txt
?) File Would like to do This will show my code clean and more readable.
Example:
router.get ('/', function (rick, race, next) {var sql = connection to a file .quire (sql, function (mistake, rows, field) {var row; if (! Mistake) {row = rows [0];} res.render ('index', {...});})}) ;
PS
Thank you in advance
You can certainly do this but remember that working with files is "too much time" cost. Whatever you need is a layer that queries you
For example You can do something like this:
myDBLayer.getNumber (function (id, country, name) {// Do stuff});
But you have to define the getNumber
function and you want to do a function for each query. Of course you can get the parameters and create a sort of abstract with it, but I think it's more efficient to read some files with all the files.
No comments:
Post a Comment