JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="main.css">
<title>Testing</title>
<script>
function get_blogposts() {
console.log("Init");
var hdrs = new Headers();
hdrs.append('Content-Type', 'application/json');
var req = new Request("https://write.as/api/collections/dar13/posts",
{ mode: "cors",
headers: hdrs,
method: "GET"});
fetch(req)
.then(function(resp) {
console.log(resp.ok);
if(!resp.ok) {
throw new Error("HTTP Error, status = " + resp.status);
}
return resp.json();
})
.then(function(json) {
console.log(json);
})
.catch(function(err) {
console.log("Error: " + err.message);
});
}
window.load = get_blogposts();
</script>
</head>
<body>
</body>
</html>