Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidRings1 committed Dec 4, 2024
1 parent fd6ede3 commit a6ee9ed
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.4.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -36,6 +48,10 @@
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/fr/lernejo/todo/Todo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package fr.lernejo.todo;

public record Todo(String message, String author) {
}
11 changes: 11 additions & 0 deletions src/main/java/fr/lernejo/todo/TodoListApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package fr.lernejo.todo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class TodoListApp {
public static void main(String[] args) {
SpringApplication.run(TodoListApp.class, args);
}
}
22 changes: 22 additions & 0 deletions src/main/java/fr/lernejo/todo/TodoListController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package fr.lernejo.todo;

import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/todo")
public class TodoListController {

private final List<Todo> TodoList = new ArrayList<>();

@PostMapping
public void addTodo(@RequestBody Todo todo) {
TodoList.add(todo);
}

@GetMapping
public List<Todo> getTodos() {
return new ArrayList<>(TodoList);
}
}

0 comments on commit a6ee9ed

Please sign in to comment.