Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
myspringweb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HyunjinNoh
myspringweb
Commits
81ae0aac
Commit
81ae0aac
authored
1 year ago
by
HyunjinNoh
Browse files
Options
Downloads
Patches
Plain Diff
get_likes
parent
e303fdd2
No related branches found
No related tags found
No related merge requests found
Pipeline
#8288
canceled
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/kr/ajousw/myspringweb/controller/MyWebController.java
+33
-17
33 additions, 17 deletions
...ava/kr/ajousw/myspringweb/controller/MyWebController.java
with
33 additions
and
17 deletions
src/main/java/kr/ajousw/myspringweb/controller/MyWebController.java
+
33
−
17
View file @
81ae0aac
package
kr.ajousw.myspringweb.controller
;
import
java.io.IOException
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -10,9 +12,13 @@ import org.springframework.web.client.RestTemplate;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
kr.ajousw.myspringweb.dto.MusicList
;
import
kr.ajousw.myspringweb.entity.FavoriteMusic
;
import
kr.ajousw.myspringweb.repository.FavoriteRepository
;
@RestController
public
class
MyWebController
{
@Autowired
FavoriteRepository
albumsRepo
;
@GetMapping
(
value
=
"/musicSearch/{term}"
)
public
String
musicSearch
(
@PathVariable
String
term
)
{
...
...
@@ -32,4 +38,14 @@ public class MyWebController {
return
"{\"resultCount\":0, \"results\":[]}"
;
}
//Get Favorite Music list from Database
@GetMapping
(
value
=
"/likes"
)
public
List
<
FavoriteMusic
>
getLikes
()
{
try
{
return
albumsRepo
.
findAll
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
toString
());
return
null
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment