Compare commits
No commits in common. "271721bbc0f1ad7980824a896e000be510763369" and "df6e425f9f38a4445b12fb6300fc67de4fe9eeda" have entirely different histories.
271721bbc0
...
df6e425f9f
13 changed files with 137 additions and 18422 deletions
20
README.md
20
README.md
|
|
@ -51,7 +51,7 @@ This application is using [React](https://reactjs.org/) for the frontend, [Netli
|
||||||
In your terminal run the following command:
|
In your terminal run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export FAUNADB_SERVER_SECRET=YourFaunaDBKeyHere
|
export FAUNADB_SECRET=YourFaunaDBKeyHere
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Run project locally
|
5. Run project locally
|
||||||
|
|
@ -140,9 +140,9 @@ Head over to [https://app.fauna.com/sign-up](https://app.fauna.com/sign-up) to c
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# on mac
|
# on mac
|
||||||
export FAUNADB_SERVER_SECRET=YourFaunaDBKeyHere
|
export FAUNADB_SECRET=YourFaunaDBKeyHere
|
||||||
# on windows
|
# on windows
|
||||||
set FAUNADB_SERVER_SECRET=YourFaunaDBKeyHere
|
set FAUNADB_SECRET=YourFaunaDBKeyHere
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [/scripts/bootstrap-fauna-database.js](https://github.com/netlify/netlify-faunadb-example/blob/f965df497f0de507c2dfdb1a8a32a81bbd939314/scripts/bootstrap-fauna-database.js) to the root directory of the project. This is an idempotent script that you can run 1 million times and have the same result (one todos database)
|
Add the [/scripts/bootstrap-fauna-database.js](https://github.com/netlify/netlify-faunadb-example/blob/f965df497f0de507c2dfdb1a8a32a81bbd939314/scripts/bootstrap-fauna-database.js) to the root directory of the project. This is an idempotent script that you can run 1 million times and have the same result (one todos database)
|
||||||
|
|
@ -163,7 +163,7 @@ Head over to [https://app.fauna.com/sign-up](https://app.fauna.com/sign-up) to c
|
||||||
npm run bootstrap
|
npm run bootstrap
|
||||||
```
|
```
|
||||||
|
|
||||||
If you login to the [FaunaDB dashboard](https://dashboard.fauna.com) you will see your todo database.
|
If you login to the [FaunaDB dashboard](https://dashboard.fauna.com] you will see your todo database.
|
||||||
|
|
||||||
### 3. Create a function
|
### 3. Create a function
|
||||||
|
|
||||||
|
|
@ -324,7 +324,7 @@ Lets rock and roll.
|
||||||
/* configure faunaDB Client with our secret */
|
/* configure faunaDB Client with our secret */
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
/* export our lambda function as named "handler" export */
|
/* export our lambda function as named "handler" export */
|
||||||
|
|
@ -410,7 +410,7 @@ So far we have created our `todo-create` function done and we've seen how we mak
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -446,7 +446,7 @@ So far we have created our `todo-create` function done and we've seen how we mak
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -491,7 +491,7 @@ So far we have created our `todo-create` function done and we've seen how we mak
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -530,7 +530,7 @@ So far we have created our `todo-create` function done and we've seen how we mak
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -569,7 +569,7 @@ So far we have created our `todo-create` function done and we've seen how we mak
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
|
||||||
|
|
@ -3,28 +3,28 @@ import faunadb from 'faunadb' /* Import faunaDB sdk */
|
||||||
/* configure faunaDB Client with our secret */
|
/* configure faunaDB Client with our secret */
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
/* export our lambda function as named "handler" export */
|
/* export our lambda function as named "handler" export */
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
/* parse the string body into a useable JS object */
|
/* parse the string body into a useable JS object */
|
||||||
const data = JSON.parse(event.body)
|
const data = JSON.parse(event.body)
|
||||||
console.log('Function `todo-create` invoked', data)
|
console.log("Function `todo-create` invoked", data)
|
||||||
const todoItem = {
|
const todoItem = {
|
||||||
data: data
|
data: data
|
||||||
}
|
}
|
||||||
/* construct the fauna query */
|
/* construct the fauna query */
|
||||||
return client.query(q.Create(q.Ref('classes/todos'), todoItem))
|
return client.query(q.Create(q.Ref("classes/todos"), todoItem))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log('success', response)
|
console.log("success", response)
|
||||||
/* Success! return the response with statusCode 200 */
|
/* Success! return the response with statusCode 200 */
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(response)
|
body: JSON.stringify(response)
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error', error)
|
console.log("error", error)
|
||||||
/* Error! return the error with statusCode 400 */
|
/* Error! return the error with statusCode 400 */
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
import faunadb from 'faunadb'
|
import faunadb from 'faunadb'
|
||||||
|
import getId from './utils/getId'
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
const data = JSON.parse(event.body)
|
const data = JSON.parse(event.body)
|
||||||
console.log('data', data)
|
console.log('data', data)
|
||||||
console.log('Function `todo-delete-batch` invoked', data.ids)
|
console.log("Function `todo-delete-batch` invoked", data.ids)
|
||||||
// construct batch query from IDs
|
// construct batch query from IDs
|
||||||
const deleteAllCompletedTodoQuery = data.ids.map((id) => {
|
const deleteAllCompletedTodoQuery = data.ids.map((id) => {
|
||||||
return q.Delete(q.Ref(`classes/todos/${id}`))
|
return q.Delete(q.Ref(`classes/todos/${id}`))
|
||||||
|
|
@ -16,13 +17,13 @@ exports.handler = (event, context, callback) => {
|
||||||
// Hit fauna with the query to delete the completed items
|
// Hit fauna with the query to delete the completed items
|
||||||
return client.query(deleteAllCompletedTodoQuery)
|
return client.query(deleteAllCompletedTodoQuery)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log('success', response)
|
console.log("success", response)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(response)
|
body: JSON.stringify(response)
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error', error)
|
console.log("error", error)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
body: JSON.stringify(error)
|
body: JSON.stringify(error)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import getId from './utils/getId'
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -11,13 +11,13 @@ exports.handler = (event, context, callback) => {
|
||||||
console.log(`Function 'todo-delete' invoked. delete id: ${id}`)
|
console.log(`Function 'todo-delete' invoked. delete id: ${id}`)
|
||||||
return client.query(q.Delete(q.Ref(`classes/todos/${id}`)))
|
return client.query(q.Delete(q.Ref(`classes/todos/${id}`)))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log('success', response)
|
console.log("success", response)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(response)
|
body: JSON.stringify(response)
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error', error)
|
console.log("error", error)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
body: JSON.stringify(error)
|
body: JSON.stringify(error)
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@ import faunadb from 'faunadb'
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
console.log('Function `todo-read-all` invoked')
|
console.log("Function `todo-read-all` invoked")
|
||||||
return client.query(q.Paginate(q.Match(q.Ref('indexes/all_todos'))))
|
return client.query(q.Paginate(q.Match(q.Ref("indexes/all_todos"))))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const todoRefs = response.data
|
const todoRefs = response.data
|
||||||
console.log('Todo refs', todoRefs)
|
console.log("Todo refs", todoRefs)
|
||||||
console.log(`${todoRefs.length} todos found`)
|
console.log(`${todoRefs.length} todos found`)
|
||||||
// create new query out of todo refs. http://bit.ly/2LG3MLg
|
// create new query out of todo refs. http://bit.ly/2LG3MLg
|
||||||
const getAllTodoDataQuery = todoRefs.map((ref) => {
|
const getAllTodoDataQuery = todoRefs.map((ref) => {
|
||||||
|
|
@ -24,7 +24,7 @@ exports.handler = (event, context, callback) => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error', error)
|
console.log("error", error)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
body: JSON.stringify(error)
|
body: JSON.stringify(error)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import getId from './utils/getId'
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -11,13 +11,13 @@ exports.handler = (event, context, callback) => {
|
||||||
console.log(`Function 'todo-read' invoked. Read id: ${id}`)
|
console.log(`Function 'todo-read' invoked. Read id: ${id}`)
|
||||||
return client.query(q.Get(q.Ref(`classes/todos/${id}`)))
|
return client.query(q.Get(q.Ref(`classes/todos/${id}`)))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log('success', response)
|
console.log("success", response)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(response)
|
body: JSON.stringify(response)
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error', error)
|
console.log("error", error)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
body: JSON.stringify(error)
|
body: JSON.stringify(error)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import getId from './utils/getId'
|
||||||
|
|
||||||
const q = faunadb.query
|
const q = faunadb.query
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: process.env.FAUNADB_SERVER_SECRET
|
secret: process.env.FAUNADB_SECRET
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.handler = (event, context, callback) => {
|
exports.handler = (event, context, callback) => {
|
||||||
|
|
@ -12,13 +12,13 @@ exports.handler = (event, context, callback) => {
|
||||||
console.log(`Function 'todo-update' invoked. update id: ${id}`)
|
console.log(`Function 'todo-update' invoked. update id: ${id}`)
|
||||||
return client.query(q.Update(q.Ref(`classes/todos/${id}`), {data}))
|
return client.query(q.Update(q.Ref(`classes/todos/${id}`), {data}))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log('success', response)
|
console.log("success", response)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(response)
|
body: JSON.stringify(response)
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error', error)
|
console.log("error", error)
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
body: JSON.stringify(error)
|
body: JSON.stringify(error)
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@
|
||||||
publish = "build"
|
publish = "build"
|
||||||
|
|
||||||
[template.environment]
|
[template.environment]
|
||||||
FAUNADB_SERVER_SECRET = "Your FaunaDB Server Secret"
|
FAUNADB_SECRET = "Your FaunaDB Server Secret"
|
||||||
|
|
|
||||||
18292
package-lock.json
generated
18292
package-lock.json
generated
File diff suppressed because it is too large
Load diff
36
scripts/bootstrap-fauna-database.js
vendored
36
scripts/bootstrap-fauna-database.js
vendored
|
|
@ -8,11 +8,11 @@ const q = faunadb.query
|
||||||
console.log(chalk.cyan('Creating your FaunaDB Database...\n'))
|
console.log(chalk.cyan('Creating your FaunaDB Database...\n'))
|
||||||
|
|
||||||
// 1. Check for required enviroment variables
|
// 1. Check for required enviroment variables
|
||||||
if (!process.env.FAUNADB_SERVER_SECRET) {
|
if (!process.env.FAUNADB_SECRET) {
|
||||||
console.log(chalk.yellow('Required FAUNADB_SERVER_SECRET enviroment variable not found.'))
|
console.log(chalk.yellow('Required FAUNADB_SECRET enviroment variable not found.'))
|
||||||
if (insideNetlify) {
|
if (insideNetlify) {
|
||||||
console.log(`Visit https://app.netlify.com/sites/YOUR_SITE_HERE/settings/deploys`)
|
console.log(`Visit https://app.netlify.com/sites/YOUR_SITE_HERE/settings/deploys`)
|
||||||
console.log('and set a `FAUNADB_SERVER_SECRET` value in the "Build environment variables" section')
|
console.log('and set a `FAUNADB_SECRET` value in the "Build environment variables" section')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
// Local machine warning
|
// Local machine warning
|
||||||
|
|
@ -21,23 +21,20 @@ if (!process.env.FAUNADB_SERVER_SECRET) {
|
||||||
console.log('You can create fauna DB keys here: https://dashboard.fauna.com/db/keys')
|
console.log('You can create fauna DB keys here: https://dashboard.fauna.com/db/keys')
|
||||||
console.log()
|
console.log()
|
||||||
ask(chalk.bold('Enter your faunaDB server key'), (err, answer) => {
|
ask(chalk.bold('Enter your faunaDB server key'), (err, answer) => {
|
||||||
if (err) {
|
|
||||||
console.log('err', err)
|
|
||||||
}
|
|
||||||
if (!answer) {
|
if (!answer) {
|
||||||
console.log('Please supply a faunaDB server key')
|
console.log('Please supply a faunaDB server key')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
createFaunaDB(process.env.FAUNADB_SERVER_SECRET).then(() => {
|
createFaunaDB(process.env.FAUNADB_SECRET).then(() => {
|
||||||
console.log('Database created')
|
console.log('Database created')
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has var. Do the thing
|
// Has var. Do the thing
|
||||||
if (process.env.FAUNADB_SERVER_SECRET) {
|
if (process.env.FAUNADB_SECRET) {
|
||||||
createFaunaDB(process.env.FAUNADB_SERVER_SECRET).then(() => {
|
createFaunaDB(process.env.FAUNADB_SECRET).then(() => {
|
||||||
console.log('Database created')
|
console.log('Database created')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -47,15 +44,15 @@ function createFaunaDB(key) {
|
||||||
console.log('Create the database!')
|
console.log('Create the database!')
|
||||||
const client = new faunadb.Client({
|
const client = new faunadb.Client({
|
||||||
secret: key
|
secret: key
|
||||||
})
|
});
|
||||||
|
|
||||||
/* Based on your requirements, change the schema here */
|
/* Based on your requirements, change the schema here */
|
||||||
return client.query(q.Create(q.Ref('classes'), { name: 'todos' }))
|
return client.query(q.Create(q.Ref("classes"), { name: "todos" }))
|
||||||
.then(()=>{
|
.then(()=>{
|
||||||
return client.query(
|
return client.query(
|
||||||
q.Create(q.Ref('indexes'), {
|
q.Create(q.Ref("indexes"), {
|
||||||
name: 'all_todos',
|
name: "all_todos",
|
||||||
source: q.Ref('classes/todos')
|
source: q.Ref("classes/todos")
|
||||||
}))
|
}))
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
// Database already exists
|
// Database already exists
|
||||||
|
|
@ -66,6 +63,7 @@ function createFaunaDB(key) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* util methods */
|
/* util methods */
|
||||||
|
|
||||||
// Test if inside netlify build context
|
// Test if inside netlify build context
|
||||||
|
|
@ -81,9 +79,9 @@ function ask(question, callback) {
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout
|
output: process.stdout
|
||||||
})
|
});
|
||||||
rl.question(question + '\n', function(answer) {
|
rl.question(question + '\n', function(answer) {
|
||||||
rl.close()
|
rl.close();
|
||||||
callback(null, answer)
|
callback(null, answer);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
const chalk = require('chalk')
|
const chalk = require('chalk')
|
||||||
|
var util = require('util');
|
||||||
|
var exec = require('child_process').exec;
|
||||||
|
|
||||||
|
function clear(){
|
||||||
|
exec('clear', function(error, stdout, stderr){
|
||||||
|
util.puts(stdout);
|
||||||
|
});
|
||||||
|
}
|
||||||
function checkForFaunaKey() {
|
function checkForFaunaKey() {
|
||||||
if (!process.env.FAUNADB_SERVER_SECRET) {
|
if (!process.env.FAUNADB_SECRET) {
|
||||||
console.log(chalk.yellow('Required FAUNADB_SERVER_SECRET enviroment variable not found.'))
|
console.log(chalk.yellow('Required FAUNADB_SECRET enviroment variable not found.'))
|
||||||
console.log(`
|
console.log(`
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
@ -10,7 +17,7 @@ You can create fauna DB keys here: https://dashboard.fauna.com/db/keys
|
||||||
|
|
||||||
In your terminal run the following command:
|
In your terminal run the following command:
|
||||||
|
|
||||||
export FAUNADB_SERVER_SECRET=YourFaunaDBKeyHere
|
export FAUNADB_SECRET=YourFaunaDBKeyHere
|
||||||
|
|
||||||
=========================
|
=========================
|
||||||
`)
|
`)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export default class App extends Component {
|
||||||
if (isLocalHost()) {
|
if (isLocalHost()) {
|
||||||
alert('FaunaDB key is not unauthorized. Make sure you set it in terminal session where you ran `npm start`. Visit http://bit.ly/set-fauna-key for more info')
|
alert('FaunaDB key is not unauthorized. Make sure you set it in terminal session where you ran `npm start`. Visit http://bit.ly/set-fauna-key for more info')
|
||||||
} else {
|
} else {
|
||||||
alert('FaunaDB key is not unauthorized. Verify the key `FAUNADB_SERVER_SECRET` set in Netlify enviroment variables is correct')
|
alert('FaunaDB key is not unauthorized. Verify the key `FAUNADB_SECRET` set in Netlify enviroment variables is correct')
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -206,6 +206,7 @@ export default class App extends Component {
|
||||||
console.log('An API error occurred', e)
|
console.log('An API error occurred', e)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
closeModal = (e) => {
|
closeModal = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const proxy = require('http-proxy-middleware')
|
const proxy = require('http-proxy-middleware');
|
||||||
|
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
app.use(
|
app.use(
|
||||||
|
|
@ -8,5 +8,5 @@ module.exports = function(app) {
|
||||||
'^/\\.netlify/functions': ''
|
'^/\\.netlify/functions': ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue