JSPM

appwrite-function-utils

0.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 13
    • Score
      100M100P100Q41857F
    • License MIT

    Package Exports

    • appwrite-function-utils

    Readme

    Appwrite Function Utils

    This repository contains a set of utility functions that can be used to build your Appwrite functions.

    Installation

    npm install --save appwrite-function-utils

    Features

    Function Handler Types

    Enabled type checking for your function handler by using the Function type.

    JavaScript

    /** type {import('appwrite-function-utils').Function} */
    const handler = async (context) => {
      // Your function code
    }
    
    export default handler

    TypeScript

    import { Function } from 'appwrite-function-utils'
    
    const handler: Function = async (context) => {
      // Your function code
    }
    
    export default handler

    Dev Server

    The appwrite-function-utils dev command will start a local server that will listen for incoming requests and execute your function handler. Assuming your function handler is located in src/main.js, add the following script to your package.json file:

    {
      "scripts": {
        "dev": "appwrite-function-utils dev src/main.js"
      }
    }

    You can use it in conjuction nodemon to automatically restart the server when you make changes to your function handler:

    npm install --save-dev nodemon
    {
      "scripts": {
        "dev": "nodemon --watch src --exec \"appwrite-function-utils dev src/main.js\""
      }
    }