Добавлен frontend

This commit is contained in:
Safgerd 2023-02-19 19:48:24 +04:00
parent e9d7cc30d9
commit 648dea05b3
2 changed files with 37 additions and 0 deletions

View File

@ -18,4 +18,28 @@ public class LabworkApplication {
public String good_morning(@RequestParam(value = "name", defaultValue = "Sir") String 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;
}
}

View 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("*");
}
}