node-pg-query
node-pg-query copied to clipboard
require pg or pg.js
I am using VS2013 (which has a very nice open source plug-in by Red Gate for Node debugging, NPM, and much more: http://www.hanselman.com/blog/IntroducingNodejsToolsForVisualStudio.aspx )
Anyway, it is still in beta and if node gets an exception (even a try with a catch) it will jump to the debugger) is there some other way you can test for pg versus pg.js?
//peerDependency - use whichever version is installed
//in the project
try {
var pg = require('pg');
} catch(e) {
try {
var pg = require('pg.js');
} catch(e) {
throw new Error("Could not require pg or pg.js - please install one or the other")
}
}