Skip to content

Commit

Permalink
Updated frontend server address mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
nhkhai committed May 18, 2024
1 parent 467c51f commit 44dd07b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

@RestController
@RequestMapping("/customers")
@CrossOrigin(origins = "http://localhost:5173")
// @CrossOrigin(origins = "http://localhost:5173")
@CrossOrigin(origins = "${server.address}")
public class CustomerController {
private CustomerService customerService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

@RestController
@RequestMapping("/products")
@CrossOrigin(origins = "http://localhost:5173")
// @CrossOrigin(origins = "http://localhost:5173")
@CrossOrigin(origins = "${server.address}")
public class ProductController {
private ProductService productService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import jakarta.validation.Valid;
import sg.com.smartinventory.entities.Review;
import sg.com.smartinventory.services.ReviewService;
import org.springframework.web.bind.annotation.RequestParam;

@RestController
@RequestMapping("/reviews")
@CrossOrigin(origins = "http://localhost:5173")
// @CrossOrigin(origins = "http://localhost:5173")
@CrossOrigin(origins = "${server.address}")
public class ReviewController {
private ReviewService reviewService;

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
spring.application.name=smart-inventory

# Server CORS Configuration.
server.address=${ADDRESS:http://localhost:5173}

# Server Port Configuration.
# The default server port is 8080.
server.port=${PORT:9090}
Expand Down

0 comments on commit 44dd07b

Please sign in to comment.