update exports

This commit is contained in:
davidwells 2018-06-11 16:39:45 -07:00
parent 55f2fc378c
commit 2600c6f38c
5 changed files with 6 additions and 6 deletions

View file

@ -7,7 +7,7 @@ const client = new faunadb.Client({
secret: process.env.FAUNADB_SECRET
});
module.exports = (event, callback) => {
exports.handler = (event, context, callback) => {
const data = JSON.parse(event.body);
console.log("create todo", data);
return client.query(q.Create(q.Ref("classes/todos"), {data}))

View file

@ -7,7 +7,7 @@ const client = new faunadb.Client({
secret: process.env.FAUNADB_SECRET
});
module.exports = (event, callback) => {
exports.handler = (event, context, callback) => {
console.log("delete todo");
return client.query(q.Delete(q.Ref("classes/todos/"+event.pathParameters.id)))
.then((response) => {

View file

@ -7,7 +7,7 @@ const client = new faunadb.Client({
secret: process.env.FAUNADB_SECRET
});
module.exports = (event, callback) => {
exports.handler = (event, context, callback) => {
console.log("readAll todo");
return client.query(q.Paginate(q.Match(q.Ref("indexes/all_todos"))))
.then((response) => {

View file

@ -7,8 +7,8 @@ const client = new faunadb.Client({
secret: process.env.FAUNADB_SECRET
});
module.exports = (event, callback) => {
console.log("readOne todo "+event.pathParameters.id);
exports.handler = (event, context, callback) => {
console.log(`readOne todo ${event.pathParameters.id}`);
return client.query(q.Get(q.Ref("classes/todos/"+event.pathParameters.id)))
.then((response) => {
console.log("success", response);

View file

@ -7,7 +7,7 @@ const client = new faunadb.Client({
secret: process.env.FAUNADB_SECRET
});
module.exports = (event, callback) => {
exports.handler = (event, context, callback) => {
const data = JSON.parse(event.body);
console.log("update todo");
return client.query(q.Update(q.Ref("classes/todos/"+event.pathParameters.id), {data}))