This repository was archived by the owner on Sep 8, 2021. It is now read-only.
File tree 10 files changed +6423
-20370
lines changed
10 files changed +6423
-20370
lines changed Original file line number Diff line number Diff line change 1
1
/* Import faunaDB sdk */
2
2
const faunadb = require ( 'faunadb' )
3
-
4
- /* configure faunaDB Client with our secret */
5
3
const q = faunadb . query
6
- const client = new faunadb . Client ( {
7
- secret : process . env . FAUNADB_SERVER_SECRET
8
- } )
9
4
10
5
/* export our lambda function as named "handler" export */
11
6
exports . handler = async ( event , context ) => {
7
+ /* configure faunaDB Client with our secret */
8
+ const client = new faunadb . Client ( {
9
+ secret : process . env . FAUNADB_SERVER_SECRET
10
+ } )
12
11
/* parse the string body into a useable JS object */
13
12
const data = JSON . parse ( event . body )
14
13
console . log ( 'Function `todo-create` invoked' , data )
Original file line number Diff line number Diff line change 1
1
/* Import faunaDB sdk */
2
2
const faunadb = require ( 'faunadb' )
3
-
4
3
const q = faunadb . query
5
- const client = new faunadb . Client ( {
6
- secret : process . env . FAUNADB_SERVER_SECRET
7
- } )
8
4
9
5
exports . handler = async ( event , context ) => {
6
+ /* configure faunaDB Client with our secret */
7
+ const client = new faunadb . Client ( {
8
+ secret : process . env . FAUNADB_SERVER_SECRET
9
+ } )
10
10
const data = JSON . parse ( event . body )
11
11
console . log ( 'data' , data )
12
12
console . log ( 'Function `todo-delete-batch` invoked' , data . ids )
Original file line number Diff line number Diff line change 1
1
/* Import faunaDB sdk */
2
2
const faunadb = require ( 'faunadb' )
3
3
const getId = require ( './utils/getId' )
4
-
5
4
const q = faunadb . query
6
- const client = new faunadb . Client ( {
7
- secret : process . env . FAUNADB_SERVER_SECRET
8
- } )
5
+
9
6
10
7
exports . handler = async ( event , context ) => {
8
+ /* configure faunaDB Client with our secret */
9
+ const client = new faunadb . Client ( {
10
+ secret : process . env . FAUNADB_SERVER_SECRET
11
+ } )
11
12
const id = getId ( event . path )
12
13
console . log ( `Function 'todo-delete' invoked. delete id: ${ id } ` )
13
14
return client . query ( q . Delete ( q . Ref ( `classes/todos/${ id } ` ) ) )
Original file line number Diff line number Diff line change 1
1
/* Import faunaDB sdk */
2
2
const faunadb = require ( 'faunadb' )
3
-
4
3
const q = faunadb . query
5
- const client = new faunadb . Client ( {
6
- secret : process . env . FAUNADB_SERVER_SECRET
7
- } )
4
+
8
5
9
6
exports . handler = ( event , context ) => {
10
7
console . log ( 'Function `todo-read-all` invoked' )
8
+ /* configure faunaDB Client with our secret */
9
+ const client = new faunadb . Client ( {
10
+ secret : process . env . FAUNADB_SERVER_SECRET
11
+ } )
11
12
return client . query ( q . Paginate ( q . Match ( q . Ref ( 'indexes/all_todos' ) ) ) )
12
13
. then ( ( response ) => {
13
14
const todoRefs = response . data
Original file line number Diff line number Diff line change 1
1
/* Import faunaDB sdk */
2
2
const faunadb = require ( 'faunadb' )
3
3
const getId = require ( './utils/getId' )
4
-
5
4
const q = faunadb . query
6
- const client = new faunadb . Client ( {
7
- secret : process . env . FAUNADB_SERVER_SECRET
8
- } )
9
5
10
6
exports . handler = ( event , context ) => {
7
+ /* configure faunaDB Client with our secret */
8
+ const client = new faunadb . Client ( {
9
+ secret : process . env . FAUNADB_SERVER_SECRET
10
+ } )
11
11
const id = getId ( event . path )
12
12
console . log ( `Function 'todo-read' invoked. Read id: ${ id } ` )
13
13
return client . query ( q . Get ( q . Ref ( `classes/todos/${ id } ` ) ) )
Original file line number Diff line number Diff line change 1
1
const faunadb = require ( 'faunadb' )
2
2
const getId = require ( './utils/getId' )
3
-
4
3
const q = faunadb . query
5
- const client = new faunadb . Client ( {
6
- secret : process . env . FAUNADB_SERVER_SECRET
7
- } )
8
4
9
5
exports . handler = ( event , context ) => {
6
+ /* configure faunaDB Client with our secret */
7
+ const client = new faunadb . Client ( {
8
+ secret : process . env . FAUNADB_SERVER_SECRET
9
+ } )
10
10
const data = JSON . parse ( event . body )
11
11
const id = getId ( event . path )
12
12
console . log ( `Function 'todo-update' invoked. update id: ${ id } ` )
You can’t perform that action at this time.
0 commit comments