此SDK與AppWrite Server版本1.6.x.兼容。對於較舊版本,請檢查以前的發行版。
AppWrite是一家開源後端,作為服務服務器,在非常易於使用REST API的背後抽象和簡化複雜和重複的開發任務。 AppWrite旨在幫助您以更安全的方式更快地開發應用程序。使用Web SDK將您的應用與AppWrite服務器集成在一起,以輕鬆開始與AppWrite Backend API和工具進行交互。有關完整的API文檔和教程,請訪問https://appwrite.io/docs

通過NPM安裝:
npm install appwrite --save如果您使用的是捆綁器(例如匯總或webpack),則可以在需要時導入AppWrite模塊:
import { Client , Account } from "appwrite" ;要使用CDN(內容輸送網絡)安裝,將以下腳本添加到標籤的底部,但是在使用任何AppWrite服務之前:
< script src =" https://cdn.jsdelivr.net/npm/[email protected] " > </ script > 要讓您啟動SDK並與AppWrite服務進行交互,則需要在項目中添加Web平台。要添加新平台,請轉到您的AppWrite控制台,選擇您在步驟中創建的項目,然後單擊“添加平台”按鈕。
從選項中,選擇添加Web平台並添加您的客戶端應用主機名。通過將主機名添加到項目平台中,您可以在項目和AppWrite API之間進行跨域通信。
使用您的AppWrite Server API端點和項目ID初始化SDK,可以在項目設置頁面中找到。
// Init your Web SDK
const client = new Client ( ) ;
client
. setEndpoint ( 'http://localhost/v1' ) // Your Appwrite Endpoint
. setProject ( '455x34dfkj' ) // Your project ID
;設置SDK對像後,訪問任何AppWrite服務,然後選擇要發送的任何請求。您想要使用的任何服務方法的完整文檔可以在您的SDK文檔或API參考部分中找到。
const account = new Account ( client ) ;
// Register User
account . create ( ID . unique ( ) , "[email protected]" , "password" , "Walter O'Brien" )
. then ( function ( response ) {
console . log ( response ) ;
} , function ( error ) {
console . log ( error ) ;
} ) ; // Init your Web SDK
const client = new Client ( ) ;
client
. setEndpoint ( 'http://localhost/v1' ) // Your Appwrite Endpoint
. setProject ( '455x34dfkj' )
;
const account = new Account ( client ) ;
// Register User
account . create ( ID . unique ( ) , "[email protected]" , "password" , "Walter O'Brien" )
. then ( function ( response ) {
console . log ( response ) ;
} , function ( error ) {
console . log ( error ) ;
} ) ;您可以使用以下資源來了解更多並獲得幫助
該庫由AppWrite自定義SDK Generator自動生成。要了解有關如何幫助我們改善此SDK的更多信息,請在發送拉裝之前檢查貢獻指南。
有關更多信息,請參閱BSD-3-CLAUSE許可證文件。