Добавлен frontend
This commit is contained in:
parent
e9d7cc30d9
commit
648dea05b3
@ -18,4 +18,28 @@ public class LabworkApplication {
|
|||||||
public String good_morning(@RequestParam(value = "name", defaultValue = "Sir") String name) {
|
public String good_morning(@RequestParam(value = "name", defaultValue = "Sir") String name) {
|
||||||
return String.format("Good morning, %s!", name);
|
return String.format("Good morning, %s!", name);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/sum")
|
||||||
|
public int sum( @RequestParam(value = "num1", defaultValue = "0") int num1,
|
||||||
|
@RequestParam(value = "num2", defaultValue = "0") int num2)
|
||||||
|
{
|
||||||
|
return num1 + num2;
|
||||||
|
}
|
||||||
|
@GetMapping("/sub")
|
||||||
|
public int sub( @RequestParam(value = "num1", defaultValue = "0") int num1,
|
||||||
|
@RequestParam(value = "num2", defaultValue = "0") int num2)
|
||||||
|
{
|
||||||
|
return num1 - num2;
|
||||||
|
}
|
||||||
|
@GetMapping("/mul")
|
||||||
|
public int mul( @RequestParam(value = "num1", defaultValue = "0") int num1,
|
||||||
|
@RequestParam(value = "num2", defaultValue = "0") int num2)
|
||||||
|
{
|
||||||
|
return num1 * num2;
|
||||||
|
}
|
||||||
|
@GetMapping("/div")
|
||||||
|
public int div( @RequestParam(value = "num1", defaultValue = "0") int num1,
|
||||||
|
@RequestParam(value = "num2", defaultValue = "0") int num2)
|
||||||
|
{
|
||||||
|
return num1 / num2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
13
src/main/java/ru/ulstu/is/labwork/WebConfiguration.java
Normal file
13
src/main/java/ru/ulstu/is/labwork/WebConfiguration.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package ru.ulstu.is.labwork;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfiguration implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**").allowedMethods("*");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user