First server connection test prototype
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PizzaExpress Web</title>
|
||||
<script src="script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button onclick="orkodyo()">test</button>
|
||||
</body>
|
||||
</html>
|
||||
16
script.js
Normal file
16
script.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const apiUrl = "https://localhost:7243";
|
||||
|
||||
function orkodyo(){
|
||||
let reply;
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
redirect: "follow"
|
||||
};
|
||||
|
||||
fetch(apiUrl + "/api/pizze", requestOptions)
|
||||
.then((response) => reply = response.text())
|
||||
.then((result) => console.log(result))
|
||||
.catch((error) => console.error(error));
|
||||
|
||||
alert(reply);
|
||||
}
|
||||
Reference in New Issue
Block a user