// Test project creation const BASE_URL = "http://localhost:3001"; async function testProjectCreation() { console.log("๐Ÿงช Testing project creation...\n"); try { // First, login to get session console.log("1. Logging in..."); const loginResponse = await fetch( `${BASE_URL}/api/auth/signin/credentials`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email: "admin@localhost.com", password: "admin123456", }), } ); console.log("Login response status:", loginResponse.status); const loginResult = await loginResponse.text(); console.log("Login result:", loginResult.substring(0, 200)); // Try a simple API call to see the auth system console.log("\n2. Testing projects API..."); const projectsResponse = await fetch(`${BASE_URL}/api/projects`); console.log("Projects API status:", projectsResponse.status); if (projectsResponse.status === 401) { console.log("โŒ Authentication required (expected for this test)"); } else { const projectsData = await projectsResponse.json(); console.log("โœ… Projects API accessible"); console.log("Number of projects:", projectsData.length); } } catch (error) { console.error("โŒ Test failed:", error.message); } } testProjectCreation();