Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.fullServerPath = 'http://localhost:' + exports.serverPort;
exports.request = request(exports.fullServerPath);
//TODO:parameterize the connection string and server port
exports.pgConfig = {
connectionString: 'pg://postgres@localhost/pg_restify'
};
exports.invalidpgConfig = {
connectionString: 'pg://postgres@localhost/pg_restify_invalid'
};
exports.pgRestifyInstance = null;
exports.logWriter = MemoryStream.createWriteStream();
exports.initDefaultServer = function(next) {
if (exports.pgRestifyInstance) {
// if already initialize just return the cached instance
return next(null, exports.pgRestifyInstance);
}
var log = bunyan.createLogger({
name: 'node-rest-api',
stream: exports.logWriter,// comment out this line for errors to log to the console
level: 'error'
});
var server = restify.createServer({log:log});