в теории всё работает, но CORS...

This commit is contained in:
ker73rus 2023-03-07 12:53:26 +04:00
parent aacaa682bc
commit 8023a347a4
8 changed files with 13 additions and 13 deletions

View File

@ -13,9 +13,9 @@
<body>
<form id="frm-items" class="row g-3">
<div class="d-flex flex-column w-25 my-5 mx-3">
Введите первое число
Введите первое
<input id="first"></input>
Введите второе число
Введите второе
<input id="second"></input>
Выберите операцию
<div>

View File

@ -9,7 +9,7 @@ function f(operation, event){
let num_1 = numberOneInput.value;
let num_2 = numberTwoInput.value;
let type = typeInput.value;
fetch('http://localhost:8080/sum?first=${num_1}&second=${num_2}&type=${type}')
fetch('http://localhost:8080/' + operation + '?first=${num_1}&second=${num_2}&type=${type}')
.then(response => response.text())
.then(res => {
resultInput.value = res;

View File

@ -1,6 +1,6 @@
package method.controller;
package com.example.demo.method.controller;
import method.service.MethodService;
import com.example.demo.method.service.MethodService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

View File

@ -1,4 +1,4 @@
package method.domain;
package com.example.demo.method.domain;
public interface IMethod<T> {
T Sum(T first, T second);

View File

@ -1,4 +1,4 @@
package method.domain;
package com.example.demo.method.domain;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package method.domain;
package com.example.demo.method.domain;
import org.springframework.stereotype.Component;

View File

@ -1,7 +1,7 @@
package method.service;
package com.example.demo.method.service;
import method.domain.IMethod;
import method.domain.MethodString;
import com.example.demo.method.domain.IMethod;
import com.example.demo.method.domain.MethodString;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package com.example.demo;
import method.service.MethodService;
import com.example.demo.method.service.MethodService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class LabworkApplicationTests {
class ApplicationTests {
@Autowired
MethodService speakerService;