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-utilsFeatures
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 handlerTypeScript
import { Function } from 'appwrite-function-utils'
const handler: Function = async (context) => {
// Your function code
}
export default handlerDev 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\""
}
}