init commit ⊂◉‿◉つ
This commit is contained in:
commit
c8c51623a6
19 changed files with 7568 additions and 0 deletions
20
functions/todos-create.js
Normal file
20
functions/todos-create.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
const faunadb = require('faunadb');
|
||||
const q = faunadb.query;
|
||||
const client = new faunadb.Client({
|
||||
secret: process.env.FAUNADB_SECRET
|
||||
});
|
||||
|
||||
module.exports = (event, callback) => {
|
||||
const data = JSON.parse(event.body);
|
||||
console.log("create todo", data);
|
||||
return client.query(q.Create(q.Ref("classes/todos"), {data}))
|
||||
.then((response) => {
|
||||
console.log("success", response);
|
||||
callback(false, response);
|
||||
}).catch((error) => {
|
||||
console.log("error", error);
|
||||
callback(error)
|
||||
})
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue