I'm not 100% what this is for now but it will be fun :)
You will need a fresh install of Ubuntu 20.04 or similar. I will be using Ubuntu 20.04 for this project so if you are using a different operating system, or distro you'll need to adjust accordingly.
Download the install script and install Docker.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Once Docker is running and you are happy with it, set up Appwrite.
docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:0.10.4
Appwrite should be up and running now, and you can view it on localhost with the port you have set. The initial sign up page should be displayed.
To use with NPM (node package manager) you can use the following command. I suggest creating a directory for your project.
npm install appwrite
Or for webpack
import { Appwrite } from "appwrite";
Or to simply use it from a CDN for playing around, or just developing
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
An example of using the Appwrite SDK in JavaScript
// Init your Web SDK
const appwrite = new Appwrite();
appwrite
.setEndpoint('http://localhost:8098/v1') // Your Appwrite Endpoint
.setProject('615968912d022') // Your project ID
// Register User
appwrite
.account.create('[email protected]', 'Password01', 'Dean Lofts')
.then(response => {
console.log(response);
}, error => {
console.log(error);
});
// Subscribe to files channel
appwrite.subscribe('files', response => {
if(response.event === 'storage.files.create') {
// Log when a new file is uploaded
console.log(response.payload);
}
});