I have created a local fauna database and can access it through the shell. I have created Collections, Indexes and Queries and it all works well. I created the endpoint alias localhost
But I cannot figure out how to access the database through javascript
I have in my function
const faunadb = require("faunadb");
const client = new faunadb.Client({
secret: process.env.FAUNADB_SECRET
});
It connects to the cloud database if I use the cloud secret, but if I change to the local secret, I get an Unauthorized Response
"name": "Unauthorized",
"message": "unauthorized. Check that endpoint, schema, port and secret are correct during client’s instantiation",
"description": "Unauthorized",
I have run
fauna list-endpoints
and the result is
localhost *
I have tried
fauna default-endpoint localhost
and the response is
Endpoint ‘localhost’ set as default endpoint.
But I still get the unauthorized error
What should I do?