gatsby-source-appwrite

1.2.1 • Public • Published

gatsby-source-appwrite

Gatsby source plugin for building websites using Appwrite as a data source

How to install

npm install gatsby-source-appwrite node-appwrite

Available options

  • appwriteEndpoint - the url of your endpoint
  • appwriteProject - appwrite project id
  • appwriteApiKey - api key of your appwrite project, with correct access rights

Examples of usage

Queries

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-appwrite`,
      options: {
        appwriteEndpoint: "http://localhost/v1",
        appwriteProject: "my-project",
        appwriteApiKey: "my-api-key",
        types: [
          {
            type: "Todo",
            query: (databases) => databases.listDocuments("my-database-id", "my-collection-id"),
          },
        ],
        types: [
          {
            type: "Movies",
            query: (databases) =>
              databases.listDocuments("my-database-id", "my-collection-id", [
                Query.equal("title", "Avatar"),
              ]),
          },
        ],
      },
    },
  ],
};

How to query for data

query MyQuery {
  appwriteTodo {
    id
    databaseId
    name
  }
}

Will result with:

{
  "data": {
    "appwriteTodo": {
      "id": "4fb16cb4-916f-5bca-baee-e7763936d272",
      "databaseId": "6359a5cdc905610fb81e",
      "name": "Hey Hey"
    }
  },
  "extensions": {}
}

Package Sidebar

Install

npm i gatsby-source-appwrite

Weekly Downloads

2

Version

1.2.1

License

MIT

Unpacked Size

7.19 kB

Total Files

5

Last publish

Collaborators

  • lekoarts
  • moonmeister