封面圖片由 @Atinux 提供
nuxt-appwrite
Appwrite 是一個自託管解決方案,為開發人員提供一套易於使用和整合的 REST API,以管理他們的核心後端需求。此模組旨在更輕鬆地將 Appwrite SDK 連接到 Nuxt。
設定
首先,將 nuxt-appwrite
依賴項新增到您的專案
npx nuxi@latest module add appwrite
接下來,將 nuxt-appwrite
新增到 nuxt.config
的 modules
部分
export default {
modules: ['nuxt-appwrite'],
appwrite: {
/* module options */
}
}
選項
API 端點 - endpoint
- 類型:
String
- 預設值:
https://cloud.appwrite.io/v1
Appwrite API 端點(控制台 -> 專案 -> 設定 -> API 端點)
專案 ID - project
- 類型:
String
- 預設值:
null
Appwrite 專案 ID(控制台 -> 專案 -> 設定 -> 專案 ID)
完整範例
export default {
modules: [
'nuxt-appwrite'
],
appwrite: {
endpoint: 'https://cloud.appwrite.io/v1',
project: 'nuxt-playground',
}
}
用法
使用 useAppwrite
composable
const { account } = useAppwrite()
try {
const res = await account.get()
console.log(res)
} catch (err) {
console.log(err)
}
伺服器端使用者動作
目前不支援
開發
- 複製此儲存庫
- 使用
yarn install
或npm install
安裝依賴項 - 使用
npm run dev
啟動開發伺服器
許可證
版權所有 (c) Herdi Tr. iam@icm.hrdtr.dev