Answers for "appwrite express"

0

appwrite express

//IMPORTS
import express from "express";
import router from "./routes/routes.js";
import sdk from "node-appwrite";
import cors from "cors";

const app = express();

//MIDDLEWARE TO TRANSFER DATA
app.use(express.urlencoded({ extended: true }));
app.use(express.json({ limit: "30mb", extended: true }));
app.use(cors());

//CONSTANTS
const PORT = process.env.PORT || 5000;

//MIDDLEWARES
app.use("/", router);

//CONNECTION WITH APPWRITE DATABASE

let client = new sdk.Client();
// export const database = new sdk.Database(client);

client
  .setEndpoint("") // Your API Endpoint
  .setProject("") // Your project ID
  .setKey(
    ""
  ); // Your secret API key

// LISTENING TO PORT
app.listen(PORT, () => {
  console.log(`Server Running on port ${PORT}`);
});
Posted by: Guest on September-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language