Back

Creating REST api

  • 0
  • Self Hosted
  • Cloud
Himanshu...πŸ₯€
3 Nov, 2023, 14:56
TypeScript
Server is running on PORT: http://localhost:2222
Error: AppwriteException [Error]
    at Client.call (C:\Users\himan\OneDrive\Desktop\wardenx-api\server\node_modules\node-appwrite\lib\client.js:180:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Databases.create (C:\Users\himan\OneDrive\Desktop\wardenx-api\server\node_modules\node-appwrite\lib\services\databases.js:81:16)
    at async createDatabase (file:///C:/Users/himan/OneDrive/Desktop/wardenx-api/server/config/Database.js:10:20) {
  code: undefined,
  type: undefined,
  response: undefined
}

whats the error ?

TL;DR
The user is asking for help with an error they encountered while trying to create a REST API. The error is an AppwriteException and the code is failing at line 10 in the Database.js file. No specific error details are given. There is no solution provided in the support thread.
D5
3 Nov, 2023, 15:02

What's the code?

Himanshu...πŸ₯€
3 Nov, 2023, 15:03
TypeScript
import { Appwrite } from "./Appwrite.js";
import * as sdk from "node-appwrite";

const databases = new sdk.Databases(Appwrite);
let wardenDC;
let wardenDCcollections;

export const createDatabase = async function () {
    try {
        wardenDC = await databases.create(
            sdk.ID.unique(),
            'wardenDC'
        );
    
        console.log(wardenDC); // Log the result of the database creation
    
        wardenDCcollections = await databases.createCollection(
            wardenDC.$id,
            sdk.ID.unique(),
            'Servers'
        );
    
        // ... (rest of your code)
    
    } catch (error) {
        console.error('Error:', error);
        // Log more specific error information as needed
    }
}    ```
Drake
5 Nov, 2023, 21:34

How about the Appwrite.js file?

Drake
5 Nov, 2023, 21:34

What server is running on port 2222?

Himanshu...πŸ₯€
8 Nov, 2023, 16:29

This one

Drake
8 Nov, 2023, 16:32

The server you're creating, right?

Drake
8 Nov, 2023, 16:32

And what about this?

Himanshu...πŸ₯€
8 Nov, 2023, 16:49

i will drop the code dont worry just need a lil time

Himanshu...πŸ₯€
8 Nov, 2023, 16:49

yup

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more