в теории всё работает, но CORS...
This commit is contained in:
parent
aacaa682bc
commit
8023a347a4
@ -13,9 +13,9 @@
|
|||||||
<body>
|
<body>
|
||||||
<form id="frm-items" class="row g-3">
|
<form id="frm-items" class="row g-3">
|
||||||
<div class="d-flex flex-column w-25 my-5 mx-3">
|
<div class="d-flex flex-column w-25 my-5 mx-3">
|
||||||
Введите первое число
|
Введите первое
|
||||||
<input id="first"></input>
|
<input id="first"></input>
|
||||||
Введите второе число
|
Введите второе
|
||||||
<input id="second"></input>
|
<input id="second"></input>
|
||||||
Выберите операцию
|
Выберите операцию
|
||||||
<div>
|
<div>
|
||||||
|
@ -9,7 +9,7 @@ function f(operation, event){
|
|||||||
let num_1 = numberOneInput.value;
|
let num_1 = numberOneInput.value;
|
||||||
let num_2 = numberTwoInput.value;
|
let num_2 = numberTwoInput.value;
|
||||||
let type = typeInput.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(response => response.text())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
resultInput.value = res;
|
resultInput.value = res;
|
||||||
|
@ -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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
@ -1,4 +1,4 @@
|
|||||||
package method.domain;
|
package com.example.demo.method.domain;
|
||||||
|
|
||||||
public interface IMethod<T> {
|
public interface IMethod<T> {
|
||||||
T Sum(T first, T second);
|
T Sum(T first, T second);
|
@ -1,4 +1,4 @@
|
|||||||
package method.domain;
|
package com.example.demo.method.domain;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package method.domain;
|
package com.example.demo.method.domain;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package method.service;
|
package com.example.demo.method.service;
|
||||||
|
|
||||||
import method.domain.IMethod;
|
import com.example.demo.method.domain.IMethod;
|
||||||
import method.domain.MethodString;
|
import com.example.demo.method.domain.MethodString;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.demo;
|
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.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class LabworkApplicationTests {
|
class ApplicationTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
MethodService speakerService;
|
MethodService speakerService;
|
Loading…
x
Reference in New Issue
Block a user