module-connector
Advanced tools
Comparing version 1.0.2 to 1.0.3
54
index.js
@@ -27,5 +27,57 @@ 'use strict' | ||
}; | ||
writeMessageAndReponse( response, message) { | ||
if( typeof response == "string" && typeof message != "string" ) { | ||
message = response; | ||
} else { | ||
this.response = response; | ||
}; | ||
if( typeof message != "undefined"){ | ||
this.message = message; | ||
} | ||
return this | ||
}; | ||
successFunctions ( response, message, code ) { | ||
this.code = code; | ||
this.success = true; | ||
return this.writeMessageAndReponse( response, message); | ||
}; | ||
failedFunctions ( response, message, code ) { | ||
this.code = code; | ||
this.success = false; | ||
return this.writeMessageAndReponse( response, message); | ||
}; | ||
ok ( response, message) { | ||
return this.successFunctions( response, message, 200); | ||
}; | ||
created ( response, message) { | ||
return this.successFunctions( response, message, 201); | ||
}; | ||
badRequest ( response, message) { | ||
return this.failedFunctions( response, message, 400); | ||
}; | ||
unauthorized ( response, message) { | ||
return this.failedFunctions( response, message, 401); | ||
}; | ||
forbidden ( response, message) { | ||
return this.failedFunctions( response, message, 403); | ||
}; | ||
notFound ( response, message) { | ||
return this.failedFunctions( response, message, 404); | ||
}; | ||
conflict ( response, message) { | ||
return this.failedFunctions( response, message, 409); | ||
}; | ||
} | ||
module.exports = moduleConnector; |
{ | ||
"name": "module-connector", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "object used to connect different backend and frontend components. in order to better control the different scenarios that could occur with the communication of these", | ||
"main": "index.js", | ||
"main": "./index.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5607
63