update exports
This commit is contained in:
parent
55f2fc378c
commit
2600c6f38c
5 changed files with 6 additions and 6 deletions
|
|
@ -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}))
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue