Skip to content

Instantly share code, notes, and snippets.

@evan-boissonnot
Created February 19, 2021 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evan-boissonnot/6f132f54fbd55fc487f9b05c38f2df66 to your computer and use it in GitHub Desktop.
Save evan-boissonnot/6f132f54fbd55fc487f9b05c38f2df66 to your computer and use it in GitHub Desktop.
fetch to our web api dotnet core
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Test api</h1>
<script>
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var myInit = {
method: 'GET',
headers: myHeaders
}
fetch('https://localhost:44357/api/v1/selfies', myInit)
.then(result => result.json())
.then(selfies => {
console.info(selfies);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment