Code Monkey home page Code Monkey logo

playground-for-node's Introduction

Appwrite's Node.js Playground 🎮

Appwrite playground is a simple way to explore the Appwrite API & Appwrite Node.js SDK. Use the source code of this repository to learn how to use the different Appwrite Node.js SDK features.

JavaScript Style Guide

Work in progress

Get Started

This playground doesn't include any NodeJS best practices but rather intended to show some of the most simple examples and use cases of using the Appwrite API in your NodeJS application.

Requirements

  • A system with NodeJS or Docker installed.
  • An Appwrite instance.
  • An Appwrite project created in the console.
  • An Appwrite API key created in the console.

Installation

  1. Clone this repository.
  2. cd into the repository.
  3. Open the app.js file found in the root of the cloned repository.
  4. Copy Project ID, endpoint and API key from Appwrite console into app.js
  5. Run the playground: NodeJS: - Install dependencies npm install - Execute the command node app.js Docker: - Execute the command docker compose up
  6. You will see the JSON response in the console.

API's Covered

  • Databse

    • Create Collection
    • List Collections
    • Delete Collection
    • Create Document
    • List Documents
    • Delete Document
  • Storage

    • Create Bucket
    • List Buckets
    • Delete Bucket
    • Upload File
    • List Files
    • Delete File
  • Users

    • Create User
    • List Users
    • Delete User
  • Functions

    • Create Function
    • List Functions
    • Delete Function
    • Upload Deployment
    • Execute function (sync)
    • Execute function (async)

Contributing

All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.

Security

For security issues, kindly email us [email protected] instead of posting a public issue in GitHub.

Follow Us

Join our growing community around the world! Follow us on Twitter, Facebook Page, Facebook Group or join our Discord Server for more help, ideas and discussions.

playground-for-node's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

playground-for-node's Issues

Wrong repository link in package.json

The link mentioned in the package.json points to the repo for Deno Playground .
"repository": "https://github.com/appwrite/playground-for-deno.git",

🐛 Bug Report: Function create doesn't work

👟 Reproduction steps

  1. Clone the repository.
  2. Install dependency npm install.
  3. Run start script npm run start.

Node: 18.15.0
node-appwrite: 9.0.0

👍 Expected behavior

According to the documentation, It should create the function.

👎 Actual Behavior

When I run npm run start, the creation of a function responds to an error:

Running Create Function API
AppwriteException [Error]: Invalid execute: Roles must be an array of strings.
    at Client.call (/Applications/Back/playground-for-node/node_modules/node-appwrite/lib/client.js:172:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Functions.create (/Applications/Back/playground-for-node/node_modules/node-appwrite/lib/services/functions.js:111:16)
    at async createFunction (/Applications/Back/playground-for-node/src/app.js:419:22)
    at async runAllTasks (/Applications/Back/playground-for-node/src/app.js:537:5) {
  code: 400,
  type: 'general_argument_invalid',
  response: {
    message: 'Invalid execute: Roles must be an array of strings.',
    code: 400,
    type: 'general_argument_invalid',
    version: '0.10.45'
  }
}

The creation of the function:

const createFunction = async () => {
    console.log(chalk.greenBright('Running Create Function API'));

    const response = await functions.create(
        ID.unique(),
        "Node Hello World",
        [Role.any()],
        "node-16.0"
    );

    functionId = response.$id;

    console.log(response);
}

🎲 Appwrite version

Version 0.10.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Upgrade our issue templates to use GitHub issue forms ✍️

Introduction

GitHub has recently rolled out a public beta for their issue forms feature. This would allow you to create interactive issue templates and validate them 🤯.

Appwrite currently uses the older issue template format. Your task is to create GitHub issue forms for this repository. Please use Appwrite's issue templates as a reference for this PR.

Tasks summary:

  • Fork & clone this repository
  • Prepare bug report issue form in .github/ISSUE_TEMPLATE/bug.yaml
  • Prepare documentation issue form in .github/ISSUE_TEMPLATE/documentation.yaml
  • Prepare feature request issue form in .github/ISSUE_TEMPLATE/feature.yaml
  • Push changes to master and test issue forms on your fork
  • Submit pull request

If you need any help, reach out to us on our Discord server.

Are you ready to work on this issue? 🤔 Let us know, and we will assign it to you 😊

Happy Appwriting!

Use environment variables for API KEY and PROJECT ID

Using environment variables for API KEY and PROJECT ID makes it not secure but also makes it easy for people wanting to try out this project. There can be a .env.example file which has empty values for the environment variables. The person setting up the project can just cp .env.example .env and fill in the appropriate values.

📚 Documentation: Create a video tutorial for the playground

💭 Description

It is hard to get started for beginners with appwrite node without a proper tutorial. Adding it, would greatly help the community as well as new-comers to the platform

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.