Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
inventory-service
Commits
3335d62c
Commit
3335d62c
authored
May 07, 2021
by
Sumaiyya Burney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes properties and adds CORS
parent
9353e892
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
ProductController.java
.../nisum/ascend/inventory/controller/ProductController.java
+3
-7
application.properties
src/main/resources/application.properties
+1
-1
No files found.
src/main/java/com/nisum/ascend/inventory/controller/ProductController.java
View file @
3335d62c
...
...
@@ -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
)
{
...
...
src/main/resources/application.properties
View file @
3335d62c
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment