Created
January 18, 2016 15:39
-
-
Save VanTudor/777662c4fb919cb4ad87 to your computer and use it in GitHub Desktop.
Express.js example API user service configuration file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function() { | |
var config = {}; | |
config.registration = { | |
mandatoryFields : [ | |
{ | |
name: "userID", | |
type: "text", | |
shouldBeUnique: true, | |
maxLength: 32 | |
}, | |
{ | |
name: "password", | |
type: "password", | |
shouldBeUnique: false, | |
maxLength: 32 | |
}, | |
{ | |
name: "email", | |
type: "text", | |
shouldBeUnique: true, | |
maxLength: 32 | |
}, | |
{ | |
name: "firstName", | |
type: "text", | |
shouldBeUnique: false, | |
maxLength: 32 | |
}, | |
{ | |
name: "lastName", | |
type: "text", | |
shouldBeUnique: false, | |
maxLength: 32 | |
} | |
], | |
optionalFields : [ | |
{ | |
name: "telephone", | |
type: "text", | |
shouldBeUnique: false, | |
maxLength: 32 | |
}, | |
{ | |
name: "photo", | |
type: "text", | |
shouldBeUnique: true, | |
maxLength: 32 | |
} | |
] | |
}; | |
config.backendServices = { | |
registerAddress : "http://example.com", | |
loginAddress : "http://example.com", | |
}; | |
config.client = {}; | |
config.backend = {}; | |
config.client.makeResponse = function(responseStatusOk, responseContent) { | |
var response = {}; | |
response.ok = responseStatusOk; | |
response.response_data = []; | |
response.response_data.push(responseContent); | |
return JSON.stringify(response); | |
}; | |
config.backend.makeRequest = function() { | |
}; | |
config.client.makeError = function(reason) { | |
return config.client.makeResponse(false, {"reason": reason}); | |
}; | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment