main
Some checks failed
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-04-05 20:37:15 +03:00
parent 9f17ced37d
commit 9486f86cca
22 changed files with 2175 additions and 29 deletions

56
test-api.js Normal file
View File

@@ -0,0 +1,56 @@
async function test() {
try {
// 1. Admin login
const loginRes = await fetch('http://localhost:3000/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: 'admin@contentgen.ai', password: 'Admin123!' })
});
const loginData = await loginRes.json();
const token = loginData.data.accessToken;
console.log("Logged in!");
// 2. Create project from standard prompt
console.log("\n--- Creating standard project...");
const projRes = await fetch('http://localhost:3000/api/projects', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
title: "Test Project",
prompt: "Uzay hakkında bir belgesel",
language: "tr",
videoStyle: "CINEMATIC",
aspectRatio: "PORTRAIT_9_16"
})
});
const projData = await projRes.json();
console.log("Standard project status:", projRes.status);
console.log("Standard project result:", JSON.stringify(projData, null, 2));
// 3. Create project from tweet
console.log("\n--- Creating tweet project...");
const tweetRes = await fetch('http://localhost:3000/api/projects/from-tweet', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
tweetUrl: "https://x.com/elonmusk/status/1893456789012345678",
language: "tr",
videoStyle: "CINEMATIC",
aspectRatio: "PORTRAIT_9_16"
})
});
const tweetData = await tweetRes.json();
console.log("Tweet project status:", tweetRes.status);
console.log("Tweet project result:", JSON.stringify(tweetData, null, 2));
} catch (err) {
console.error("Error:", err);
}
}
test();