39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
export default defineEventHandler(async () => {
 | 
						|
  try {
 | 
						|
    // Spring Boot 서버 URL (환경변수로 설정 가능)
 | 
						|
    const springBootUrl = process.env.SPRING_BOOT_URL || 'http://localhost:8080';
 | 
						|
    const filesUrl = `${springBootUrl}/api/fasta/files`;
 | 
						|
    
 | 
						|
    console.log(`Spring Boot 서버에서 파일 목록 조회 중: ${filesUrl}`);
 | 
						|
    
 | 
						|
    const response = await fetch(filesUrl, {
 | 
						|
      method: 'GET',
 | 
						|
      headers: {
 | 
						|
        'Content-Type': 'application/json'
 | 
						|
      }
 | 
						|
    });
 | 
						|
    
 | 
						|
    if (!response.ok) {
 | 
						|
      const errorText = await response.text();
 | 
						|
      throw createError({
 | 
						|
        statusCode: response.status,
 | 
						|
        statusMessage: `Spring Boot 서버 오류: ${errorText}`
 | 
						|
      });
 | 
						|
    }
 | 
						|
    
 | 
						|
    const files = await response.json();
 | 
						|
    console.log('Spring Boot 서버 파일 목록 응답:', files);
 | 
						|
    
 | 
						|
    return {
 | 
						|
      success: true,
 | 
						|
      files: files
 | 
						|
    };
 | 
						|
    
 | 
						|
  } catch (error) {
 | 
						|
    console.error('파일 목록 조회 오류:', error);
 | 
						|
    throw createError({
 | 
						|
      statusCode: 500,
 | 
						|
      statusMessage: `파일 목록 조회 실패: ${error.message}`
 | 
						|
    });
 | 
						|
  }
 | 
						|
});  |