return data

This commit is contained in:
davidwells 2018-06-11 16:43:57 -07:00
parent 2600c6f38c
commit 1019fa7696
5 changed files with 40 additions and 10 deletions

View file

@ -12,9 +12,15 @@ exports.handler = (event, context, callback) => {
return client.query(q.Get(q.Ref("classes/todos/"+event.pathParameters.id)))
.then((response) => {
console.log("success", response);
callback(false, response);
return callback(null, {
statusCode: 200,
body: JSON.stringify(response)
})
}).catch((error) => {
console.log("error", error);
callback(error)
return callback(null, {
statusCode: 400,
body: JSON.stringify(error)
})
})
};