diff --git a/README.md b/README.md index 9065ebe..17d2d9e 100644 --- a/README.md +++ b/README.md @@ -252,15 +252,15 @@ Lets rock and roll. { "name": "netlify-fauna", "scripts": { - "ABOUT-bootstrap-command": "#👇 scaffold and setup FaunaDB #", + "👇 ABOUT-bootstrap-command": "💡 scaffold and setup FaunaDB #", "bootstrap": "node ./scripts/bootstrap-fauna-database.js", - "ABOUT-start-command": "#👇 start the app and server #", + "👇 ABOUT-start-command": "💡 start the app and server #", "start": "npm-run-all --parallel start:app start:server", "start:app": "react-scripts start", "start:server": "netlify-lambda serve functions -c ./webpack.config.js", - "ABOUT-prebuild-command": "#👇 before 'build' runs, run the 'bootstrap' command #", + "👇 ABOUT-prebuild-command": "💡 before 'build' runs, run the 'bootstrap' command #", "prebuild": "echo 'setup faunaDB' && npm run bootstrap", - "ABOUT-build-command": "#👇 build the react app and the serverless functions #", + "👇 ABOUT-build-command": "💡 build the react app and the serverless functions #", "build": "npm-run-all --parallel build:**", "build:app": "react-scripts build", "build:functions": "netlify-lambda build functions -c ./webpack.config.js", diff --git a/functions/todos-create.js b/functions/todos-create.js index 2c23a40..c353543 100644 --- a/functions/todos-create.js +++ b/functions/todos-create.js @@ -1,3 +1,4 @@ +/* Import faunaDB sdk */ import faunadb from 'faunadb' const q = faunadb.query @@ -8,7 +9,11 @@ const client = new faunadb.Client({ exports.handler = (event, context, callback) => { const data = JSON.parse(event.body) console.log("Function `todo-create` invoked", data) - return client.query(q.Create(q.Ref("classes/todos"), {data})) + const todoItem = { + data: data + } + /* construct the fauna query */ + return client.query(q.Create(q.Ref("classes/todos"), todoItem)) .then((response) => { console.log("success", response) return callback(null, { diff --git a/functions/todos-delete-batch.js b/functions/todos-delete-batch.js index 3e0479c..d671fc5 100644 --- a/functions/todos-delete-batch.js +++ b/functions/todos-delete-batch.js @@ -1,3 +1,4 @@ +/* Import faunaDB sdk */ import faunadb from 'faunadb' import getId from './utils/getId' diff --git a/functions/todos-delete.js b/functions/todos-delete.js index 122f028..93b25cb 100644 --- a/functions/todos-delete.js +++ b/functions/todos-delete.js @@ -1,3 +1,4 @@ +/* Import faunaDB sdk */ import faunadb from 'faunadb' import getId from './utils/getId' diff --git a/functions/todos-read-all.js b/functions/todos-read-all.js index 05e81a8..403dbf5 100644 --- a/functions/todos-read-all.js +++ b/functions/todos-read-all.js @@ -1,3 +1,4 @@ +/* Import faunaDB sdk */ import faunadb from 'faunadb' const q = faunadb.query diff --git a/functions/todos-read.js b/functions/todos-read.js index f5b388b..92e382a 100644 --- a/functions/todos-read.js +++ b/functions/todos-read.js @@ -1,3 +1,4 @@ +/* Import faunaDB sdk */ import faunadb from 'faunadb' import getId from './utils/getId' diff --git a/functions/todos-update.js b/functions/todos-update.js index 76486fc..3333d71 100644 --- a/functions/todos-update.js +++ b/functions/todos-update.js @@ -1,3 +1,4 @@ +/* Import faunaDB sdk */ import faunadb from 'faunadb' import getId from './utils/getId' diff --git a/package.json b/package.json index 64e1f8e..3ced196 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,11 @@ }, "scripts": { "bootstrap": "node ./scripts/bootstrap-fauna-database.js", + "docs": "md-magic --path '**/*.md' --ignore 'node_modules'", "checkForFaunaKey": "node ./scripts/check-for-fauna-key.js", - "start": "npm-run-all --parallel checkForFaunaKey startApp startServer", - "startApp": "react-scripts start", - "startServer": "netlify-lambda serve functions -c ./webpack.config.js", + "start": "npm-run-all --parallel checkForFaunaKey start:app start:server", + "start:app": "react-scripts start", + "start:server": "netlify-lambda serve functions -c ./webpack.config.js", "prebuild": "echo 'setup faunaDB' && npm run bootstrap", "build": "npm-run-all --parallel build:**", "build:app": "react-scripts build", @@ -21,6 +22,7 @@ "test": "react-scripts test --env=jsdom" }, "devDependencies": { + "markdown-magic": "^0.1.22", "netlify-lambda": "^0.4.0", "npm-run-all": "^4.1.3" },