File tree 2 files changed +5
-3
lines changed 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -488,6 +488,7 @@ Example:
488
488
` ` ` js
489
489
// Helper for linking to external query files:
490
490
function sql (file ) {
491
+ // consider using here: path.join(__dirname, file)
491
492
return new pgp.QueryFile (file, {minify: true });
492
493
}
493
494
@@ -504,7 +505,7 @@ db.one(sqlFindUser, {id: 123})
504
505
}
505
506
});
506
507
` ` `
507
-
508
+
508
509
File ` findUser .sql ` :
509
510
` ` ` sql
510
511
/*
Original file line number Diff line number Diff line change @@ -87,11 +87,12 @@ var $npm = {
87
87
* // - have your sql provider module as ./sql/index.js
88
88
*
89
89
* var QueryFile = require('pg-promise').QueryFile;
90
+ * var path = require('path');
90
91
*
91
92
* // Helper for linking to external query files:
92
93
* function sql(file) {
93
- * var relativePath = './db/sql/' ;
94
- * return new QueryFile(relativePath + file , {minify: true});
94
+ * var fullPath = path.join(__dirname, file); // generating full path ;
95
+ * return new QueryFile(fullPath , {minify: true});
95
96
* }
96
97
*
97
98
* var sqlProvider = {
You can’t perform that action at this time.
0 commit comments