import axios from 'axios';
/**
 * Upload routes to APIForge server
 */
export async function uploadRoutes(routes, options) {
    const url = options.apiForgeUrl || process.env.APIFORGE_URL || 'http://localhost:3000';
    try {
        const response = await axios.post(`${url}/api/upload-routes`, {
            projectName: options.projectName,
            routes,
            baseUrl: options.baseUrl,
            framework: 'Express',
        }, {
            headers: {
                'Content-Type': 'application/json',
                'X-API-Key': options.apiKey,
            },
            timeout: 30000,
        });
        console.log('✅ Uploaded to APIForge:', response.data);
    }
    catch (error) {
        console.error('❌ Upload failed:', error.message);
        throw error;
    }
}
