JSPM

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

Create Appwrite apps with your server-side rendering

Package Exports

  • appwrite-ssr
  • appwrite-ssr/src/index.ts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (appwrite-ssr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

appwrite-ssr

appwrite-ssr will help you to create ssr applications with appwrite.

🛠️ Installation Steps:

1. download appwrite-ssr

npm i appwrite-ssr

2. import appwrite-ssr

import appwriteSSR from "appwrite-ssr";

3. set up envirenment variables.ą Variables have to be APPWRITE_ENDPOINT and APPWRITE_PROJECT_ID

APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1 APPWRITE_PROJECT_ID="jfdajfjajůlaj"

4. set users session into appwriteSSR

appwriteSSR.setSession(); OR appwriteSSR.setCookie(cookies); OR appwriteSSR.none()

5. log user into your application

const { account } = appwriteSSR.none()
const { sessionLegacyToken, sessionToken } = await account.logInViaEmail(
    email,
    password
  );

6. initialize buckets

    import appwriteSSR from '@app/appwrite-ssr'

    const { Bucket } = appwriteSSR.setSession(session)

    const bucket = new Bucket('bucket id')

    bucket.getParamsFromURL(url)
    bucket.createFile()

7. initialize collections

  import type {
    UserInfoDocument,
    UserInfoDocumentCreate,
  } from '@app/ts-types'

    import appwriteSSR from '@app/appwrite-ssr'

    const { Collection } = appwriteSSR.setSession(session)

    const userInfo =new Collection<UserInfoDocument, UserInfoDocumentCreate>('account', 'userInfo'),
    userInfo.createDocument({}, [userId])

}

used packages/technologies:

appwrite

🛡️ License:

This project is licensed under the MIT

💖 Any questions?

otaprokopec@gmail.com