Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IMAGE_KIT_ENDPOINT = https://ik.imagekit.io/rm4xafy4n
IMAGE_KIT_PUBLIC_KEY = public_i8BCEItAkh0yBCc7U696zl/pYcs=
IMAGE_KIT_PRIVATE_KEY = private_Tt7ocQuHzg6RMRrXqHXYne4G6Ls=

CLIENT_URL = http://localhost:5173
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
27 changes: 27 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import express from "express";
import cors from "cors";
import ImageKit from "imagekit";

const port = process.env.PORT || 3000;
const app = express();

app.use(
cors({
origin: process.env.CLIENT_URL,
})
);

const imagekit = new ImageKit({
urlEndpoint: process.env.IMAGE_KIT_ENDPOINT,
publicKey: process.env.IMAGE_KIT_PUBLIC_KEY,
privateKey: process.env.IMAGE_KIT_PRIVATE_KEY,
});

app.get("/api/upload", (req, res) => {
const result = imagekit.getAuthenticationParameters();
res.send(result);
});

app.listen(port, () => {
console.log("Server running on 3000");
});
Loading