Skip to content
Snippets Groups Projects
Commit 43b0d9be authored by 김영훈's avatar 김영훈
Browse files

Merge branch 'master' into 'main'

musicSearch

See merge request !2
parents f6f7aa75 81740ffa
No related branches found
No related tags found
1 merge request!2musicSearch
......@@ -41,6 +41,21 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
</dependency>
</dependencies>
<build>
......
package com.ajou.prcoding.myweb.Controller;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.net.URI;
import com.ajou.prcoding.myweb.dto.MusicList;
@RestController
public class MyWebController {
RestTemplate restTemplate = new RestTemplate();
MusicList list;
@GetMapping(value = "/musicSearch/{term}")
public MusicList musicSearchByPath(@PathVariable String term){
try {
String url = "https://itunes.apple.com/search?term=aespa&entity=album";
String response = restTemplate.getForObject(url, String.class);
ObjectMapper mapper = new ObjectMapper();
list = mapper.readValue(response, MusicList.class);
System.out.println(list.getResultCount());
return list;
}catch (IOException e){
System.out.println(e.toString());
}
return list;
}
@GetMapping(value = "/musicSearch")
public String musicSearchByParam(@RequestParam String term){
return "Hello Param!";
}
}
package com.ajou.prcoding.myweb.dto;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@ToString
public class MusicList {
private Integer resultCount;
private List<Map<String, Object>> results;
}
server.port = 80
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/webdev?serverTimezone=UTC
spring.datasource.url=jdbc:mysql://210.107.196.163:40198/webdev?serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=y2k96139613!
spring.datasource.password=0815
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.type.descriptor.sql=trace
......
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<title>muiBasic</title>
<meta charset="UTF-8" />
</head>
<body>
<div id="app"></div>
<script src="./bundle.js" type="text/javascript"></script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment