Skip to content

Instantly share code, notes, and snippets.

@andrisro
Last active May 8, 2019 08:45
Show Gist options
  • Save andrisro/0d8e47552c2912ac050cc33437239d73 to your computer and use it in GitHub Desktop.
Save andrisro/0d8e47552c2912ac050cc33437239d73 to your computer and use it in GitHub Desktop.
Example for d.velop DMS-App-Mapping Creation in NodeJS
//main resource on base app link /{appname}/
exports.handler = async (event) => {
var result = { '_links' :
{
'featuresdescription':
{
'href' :'/arol/featuresdescription/'
},
"sources":
{
'href':'/arol/sources'
}
},
'name': 'arol_cloud',
'version': {
'major': '0',
'minor': '0',
'micro': '1',
'qualifier': 'none'
}
};
const response = {
statusCode: 200,
headers: {
'content-type':'application/hal+json'
},
body: JSON.stringify(result)
};
return response;
};
//sources description resource on sources link (defined in main resource) /sources/
exports.handler = async (event) => {
var result = {
"sources" : [{
"id" : "/arol/sources/source1",
"displayName" : "MySourceAROL",
"categories": [{
"key": "mycategory1",
"displayName": "My category 1"
},
{
"key": "mycategory2",
"displayName": "My category 2"
}],
"properties" : [{
"key" : "myprop1",
"displayName" : "My property 1"
},
{
"key" : "myprop2",
"displayName" : "My property 2"
},
{
"key" : "myprop3",
"displayName" : "My property 3"
}]
}]
};
const response = {
statusCode: 200,
body: result,
headers: {
'content-type':'application/hal+json'
},
};
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment