Skip to content

Commit

Permalink
add why-ts code
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua1988 committed Nov 5, 2020
1 parent 7d559da commit c7febf2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
25 changes: 25 additions & 0 deletions why-ts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// api url
var url = 'https://jsonplaceholder.typicode.com/users/1';

// dom
var username = document.querySelector('#username');
var email = document.querySelector('#email');
var address = document.querySelector('#address');

// user data
var user = {};

function startApp() {
axios
.get(url)
.then(function (response) {
console.log(response);
user = response.data;
// TODO: 이름, 이메일, 주소 표시하기
})
.catch(function (error) {
console.log(error);
});
}

startApp();
19 changes: 19 additions & 0 deletions why-ts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Why Typescript?</title>
</head>
<body>
<h1>사용자 정보</h1>
<div>
<p>이름: <span id="username"></span></p>
<p>이메일: <span id="email"></span></p>
<p>주소: <span id="address"></span></p>
</div>

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="./app.js"></script>
</body>
</html>

0 comments on commit c7febf2

Please sign in to comment.