Commit 3335d62c authored by Sumaiyya Burney's avatar Sumaiyya Burney

Fixes properties and adds CORS

parent 9353e892
......@@ -6,23 +6,19 @@ import com.nisum.ascend.inventory.model.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
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;
import org.springframework.web.bind.annotation.*;
import com.nisum.ascend.inventory.service.ProductService;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import reactor.core.publisher.Flux;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
import com.nisum.ascend.inventory.service.ProductService;
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/products")
public class ProductController {
......@@ -40,7 +36,7 @@ public class ProductController {
public ResponseEntity<Flux<ProductDto>> getAllProducts() {
return ResponseEntity.ok(productService.findAllProducts());
}
}
@PostMapping("")
public Mono<ProductDto> postProduct(@RequestBody Product product) {
......
......@@ -3,4 +3,4 @@ spring.config.import=classpath:secret.properties
server.port=8080
spring.data.mongodb.uri=mongodb+srv://admin:${db.password}@inventory-promotions.d4nfz.mongodb\
.net/${spring.data.mongodb.database}?retryWrites=true&w=majority
spring.data.mongodb.database=test
spring.data.mongodb.database=products-promotions-DB
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment