-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloWorldButBetter.java
More file actions
58 lines (48 loc) · 1.89 KB
/
HelloWorldButBetter.java
File metadata and controls
58 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package ro.cristi.curs.controller.v2;
import java.util.ArrayList;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
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 ro.cristi.curs.dto.HelloResponseButBetter;
@RestController
@RequestMapping("/v2")
public class HelloWorldButBetter {
@GetMapping(path = "/lista/limbaje")
public String getLimbaje(){
ArrayList<String> listaLimbaje = new ArrayList<String>(){
{
add("Java");
add("C++");
add("Python");
add("N-am avut inspiratie");
}
};
return listaLimbaje.toString();
}
@GetMapping(path = "/lista/jocuri")
public String getJocuri(){
ArrayList<String> listaJocuri = new ArrayList<String>() {
{
add("Osu!");
add("Genshin");
add("Sekai");
add("Adofai");
}
};
return listaJocuri.toString();
}
@GetMapping(path = "/vorbe_intelepte")
public HelloResponseButBetter responseVorba(){
HelloResponseButBetter respo = new HelloResponseButBetter();
respo.setMotivational("iti merge bine vere");
respo.setDemotivational("sau poate ca nu cred ca o sa iti mearga (plangi)");
return respo;
}
@PostMapping(path = "/vorbe_neintelepte", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public String postHelloV2(@RequestBody HelloResponseButBetter helloRequest){
return "Vorbele tale motivationale: " + helloRequest.getMotivational() + "\nSi alea demotivationale: " + helloRequest.getDemotivational();
}
}