JSPM

gatsby-source-appwrite

1.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q28339F
  • License MIT

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

Package Exports

  • gatsby-source-appwrite
  • gatsby-source-appwrite/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gatsby-source-appwrite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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": {}
}