1//IMPORTS
2import express from "express";
3import router from "./routes/routes.js";
4import sdk from "node-appwrite";
5import cors from "cors";
6
7const app = express();
8
9//MIDDLEWARE TO TRANSFER DATA
10app.use(express.urlencoded({ extended: true }));
11app.use(express.json({ limit: "30mb", extended: true }));
12app.use(cors());
13
14//CONSTANTS
15const PORT = process.env.PORT || 5000;
16
17//MIDDLEWARES
18app.use("/", router);
19
20//CONNECTION WITH APPWRITE DATABASE
21
22let client = new sdk.Client();
23// export const database = new sdk.Database(client);
24
25client
26 .setEndpoint("") // Your API Endpoint
27 .setProject("") // Your project ID
28 .setKey(
29 ""
30 ); // Your secret API key
31
32// LISTENING TO PORT
33app.listen(PORT, () => {
34 console.log(`Server Running on port ${PORT}`);
35});
36