triplecheck-repository-fauna
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

triplecheck-repository-fauna

TripleCheck database repository

TripleCheck: FaunaDB database repository

Database utility for using FaunaDB with the TripleCheck broker. It implements the repository base at triplecheck-core.

Instructions

  • In Fauna, create a database called triplecheck-broker.
  • Under Security, create a key for the database and set the role to Server
  • Paste the key's value into the .env file like this: FAUNA_KEY=some-secret-random-key
  • Create a new collection (call it triplecheck)
  • Create an index called Key and set the term to data.key; also enable Serialized and Unique
  • By default the Fauna repository will pick up an environment variable called FAUNA_KEY (as per above), so use something like dotenv to simplify getting that value

Basic implementation

import { TripleCheckBroker } from 'triplecheck-broker';
import { FaunaRepository } from 'triplecheck-repository-fauna';

import dotenv from 'dotenv';
dotenv.config();

const repository = FaunaRepository();
const request = "Get this from your API request and transform it as needed";
const payload = "Body";
const { responseData, status, headers } = await TripleCheckBroker(request, payload, repository);

Package Sidebar

Install

npm i triplecheck-repository-fauna

Weekly Downloads

9

Version

1.0.0

License

MIT

Unpacked Size

743 kB

Total Files

37

Last publish

Collaborators

  • mikaelvesavuori