aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/encora/Main.java5
-rw-r--r--src/main/resources/application.yml2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/encora/Main.java b/src/main/java/com/encora/Main.java
index a233550..47d72c0 100644
--- a/src/main/java/com/encora/Main.java
+++ b/src/main/java/com/encora/Main.java
@@ -27,6 +27,7 @@ public class Main {
SpringApplication.run(Main.class, args);
}
+
// Get all to dos.
@GetMapping("/todos")
@ResponseStatus(value=HttpStatus.OK)
@@ -34,6 +35,7 @@ public class Main {
return toDosRepository.findAll();
}
+
// Add a new to do.
@ResponseStatus(value=HttpStatus.BAD_REQUEST, reason="Text is longer than 120 characters.")
public static class longerThanMaxException extends RuntimeException {}
@@ -57,6 +59,7 @@ public class Main {
toDosRepository.save(todo);
}
+
// Updates to do with new information
@ResponseStatus(value=HttpStatus.BAD_REQUEST, reason="No to do with such index.")
public static class toDoNotFound extends RuntimeException {}
@@ -77,7 +80,6 @@ public class Main {
// Update a to do with "done".
-
@PostMapping("/todos/{id}/done")
@ResponseStatus(value=HttpStatus.OK)
public void setDone(@PathVariable("id") Integer id) {
@@ -90,6 +92,7 @@ public class Main {
toDosRepository.save(selectedToDo);
}
+
// Update a to do to set "done" as false.
@PutMapping("/todos/{id}/undone")
@ResponseStatus(value=HttpStatus.OK)
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index afef73d..f9e9468 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,2 +1,2 @@
server:
- port: 9090 \ No newline at end of file
+ port: 9090