Skip to content

Instantly share code, notes, and snippets.

@evbruno
Last active May 24, 2022 21:07
Show Gist options
  • Save evbruno/07a625ed2a758ba915f8f4822cf76f9f to your computer and use it in GitHub Desktop.
Save evbruno/07a625ed2a758ba915f8f4822cf76f9f to your computer and use it in GitHub Desktop.
skelleton JS with fauna

shell

mkdir dumb-project && cd dumb-project
npm init -y
yarn add faunadb
docker run -p 8443:8443 fauna/faunadb

index.js

var faunadb = require('faunadb'),
  q = faunadb.query

var client = new faunadb.Client({
  secret: 'secret',
  port: 8443,
  domain: 'localhost',
  scheme: 'http',
});

client.query(q.Now())
.then(function (res) { console.log('Result:', res) })
.catch(function (err) { console.log('Error:', err) })

run

$ node index.js
Result: Time("2022-05-24T21:06:36.248Z")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment