Правки.
This commit is contained in:
parent
022cd81034
commit
f6c5cf9cfd
@ -1,8 +1,16 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
function App() {
|
||||
|
||||
useEffect(() =>{
|
||||
fetch('http:/localhost:8080/String')
|
||||
.then(response => response.text())
|
||||
.then(result => console.log(result))
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.example.spring_online_calculator;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@ -13,8 +14,9 @@ public class SpringOnlineCalculatorApplication {
|
||||
SpringApplication.run(SpringOnlineCalculatorApplication.class, args);
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("/String")
|
||||
public String PrintName(@RequestParam(value = "str", defaultValue = "Иван") String str) {
|
||||
return String.format("Вы ввели %s!", str);
|
||||
public String PrintName(@RequestParam(value = "Егор", defaultValue = "Иван") String str) {
|
||||
return String.format("Привет, %s!", str);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user