-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
9 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
backend/src/main/java/com/test/backend/api/ProductApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.test.backend.api; | ||
|
||
import com.test.backend.business.ProductBusiness; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/product") | ||
public class ProductApi { | ||
|
||
private final ProductBusiness business; | ||
|
||
public ProductApi(ProductBusiness business) { | ||
this.business = business; | ||
} | ||
|
||
|
||
@GetMapping("/{id}") | ||
public ResponseEntity<String> getProductById(@PathVariable("id") String id){ | ||
String response = business.getProductById(id); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/com/test/backend/business/ProductBusiness.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.test.backend.business; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class ProductBusiness { | ||
|
||
public String getProductById(String id){ | ||
// TODO: Get data from database | ||
return id; | ||
} | ||
} |