Compare commits

..

No commits in common. "2c6869c6dbe7d9c8d6ec7ba464ecbfe0124e669c" and "2703c895b1a805ecfc0a9f62574db66606d0d223" have entirely different histories.

2 changed files with 17 additions and 35 deletions

View File

@ -1,35 +0,0 @@
package com.example.demo.Controller;
import org.springframework.web.bind.annotation.*;
@RestController
@CrossOrigin
public class Controllers {
@GetMapping("/plus")
public @ResponseBody Integer Plus (@RequestParam (required = false, defaultValue = "0") int val1,
@RequestParam (required = false, defaultValue = "0") int val2){
return val1 + val2;
}
@GetMapping("/minus")
public @ResponseBody Integer Minus (@RequestParam (required = false, defaultValue = "0") int val1,
@RequestParam (required = false, defaultValue = "0") int val2){
return val1 - val2;
}
@GetMapping("/mult")
public @ResponseBody Integer Mult (@RequestParam (required = false, defaultValue = "0") int val1,
@RequestParam (required = false, defaultValue = "0") int val2){
return val1 * val2;
}
@GetMapping("/div")
public @ResponseBody Integer Div (@RequestParam (required = false, defaultValue = "0") int val1,
@RequestParam (required = false, defaultValue = "1") int val2){
return val1 / val2;
}
}

View File

@ -0,0 +1,17 @@
package com.example.demo.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class Main {
@GetMapping
public String helloWorld(@RequestParam(name = "name", required = false, defaultValue = "World") String name, Model model){
model.addAttribute( "name", name);
return "hello-world!";
}
}