diff --git a/functions/todos-create.js b/functions/todos-create.js index ad858e9..fb16d33 100644 --- a/functions/todos-create.js +++ b/functions/todos-create.js @@ -10,25 +10,25 @@ const client = new faunadb.Client({ exports.handler = (event, context, callback) => { /* parse the string body into a useable JS object */ const data = JSON.parse(event.body) - console.log("Function `todo-create` invoked", data) + console.log('Function `todo-create` invoked', 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) - /* Success! return the response with statusCode 200 */ - return callback(null, { - statusCode: 200, - body: JSON.stringify(response) + return client.query(q.Create(q.Ref('classes/todos'), todoItem)) + .then((response) => { + console.log('success', response) + /* Success! return the response with statusCode 200 */ + return callback(null, { + statusCode: 200, + body: JSON.stringify(response) + }) + }).catch((error) => { + console.log('error', error) + /* Error! return the error with statusCode 400 */ + return callback(null, { + statusCode: 400, + body: JSON.stringify(error) + }) }) - }).catch((error) => { - console.log("error", error) - /* Error! return the error with statusCode 400 */ - return callback(null, { - statusCode: 400, - body: JSON.stringify(error) - }) - }) } diff --git a/src/setupProxy.js b/src/setupProxy.js index e569002..efcadc9 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -1,4 +1,4 @@ -const proxy = require('http-proxy-middleware'); +const proxy = require('http-proxy-middleware') module.exports = function(app) { app.use( @@ -8,5 +8,5 @@ module.exports = function(app) { '^/\\.netlify/functions': '' } }) - ); -}; \ No newline at end of file + ) +} \ No newline at end of file