We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92d3ab5 commit f5111eeCopy full SHA for f5111ee
src/main/java/com/gb/didgen/IdGeneratorController.java
@@ -0,0 +1,19 @@
1
+package com.gb.didgen;
2
+
3
+import com.gb.didgen.exception.ClockMovedBackException;
4
+import com.gb.didgen.exception.NodeIdOutOfBoundException;
5
+import com.gb.didgen.service.IdGenerator;
6
+import org.springframework.http.ResponseEntity;
7
+import org.springframework.web.bind.annotation.GetMapping;
8
+import org.springframework.web.bind.annotation.RestController;
9
10
+@RestController("/id")
11
+public class IdGeneratorController {
12
13
+ private IdGenerator idGenerator;
14
15
+ @GetMapping(produces = {"application/JSON"})
16
+ public ResponseEntity<?> getNextId() throws NodeIdOutOfBoundException, ClockMovedBackException {
17
+ return ResponseEntity.ok(idGenerator.generateId());
18
+ }
19
+}
0 commit comments