Skip to content

Commit

Permalink
링크 변경 (#14)
Browse files Browse the repository at this point in the history
* html파일 생성

* view 파일

* view 최신화

* 링크 변경
  • Loading branch information
kws07042 authored Jun 21, 2024
1 parent ecdac3b commit 48c251a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 56 deletions.
36 changes: 6 additions & 30 deletions src/view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ <h1>어떨때 사용하나요?</h1>
<h1>데이터 전체 조회 API</h1>
<div class="data_container">
<div>
<p>GET</p><a href="http://34.197.44.20/admin/users" target="_blank">/admin/users</a>
<span id="user-count"></span>
</div>
<div>
<p>GET</p><a href="http://34.197.44.20/books/books" target="_blank">/books/books</a>
<span id="book-count"></span>
</div>
<div>
<p>GET</p><a href="http://34.197.44.20/coupang_products/all" target="_blank">/coupang_products/all</a>
<span id="coupang-count"></span>

</div>
</div>
</section>
Expand All @@ -46,20 +37,7 @@ <h1>데이터 전체 조회 API</h1>
<h1>특정 조건의 데이터 조회 API</h1>
<div class="data_container">
<div>
<p>GET</p><a href="http://34.197.44.20/admin/user/000043c2-b919-4281-9dab-f2a5b446973b" target="_blank">/admin/users/1</a>
<span>유저 아이디 1</span>
</div>
<div>
<p>GET</p><a href="http://34.197.44.20/books/info/1" target="_blank">/books/info/1</a>
<span id="book-count-2">책 아이디 1</span>
</div>
<div>
<p>GET</p><a href="http://localhost:5000/coupang_products/product/1" target="_blank">/coupang_products
/product/1</a>
<span id="coupang-count-2">쿠팡 제품 아이디 1</span>
</div>
<div>
<p>GET</p><a href="http://34.197.44.20/coupang_products/food" target="_blank">/coupang_products/food</a>

<span>쿠팡 제품 카테고리:음식</span>
</div>
</div>
Expand All @@ -71,13 +49,12 @@ <h1>API TEST (GET)</h1>
<ul>
<li><a href="#" onclick="showInput('users'); return false;">특정 유저 조회</a></li>
<li><a href="#" onclick="showInput('books'); return false;">특정 책 조회</a></li>
<li><a href="#" onclick="showInput('products'); return false;">특정 제품 조회</a></li>

</ul>
</nav>
<div id="input-container">
<div class="input-section users active">
<label for="input-id-users">/admin/user/</label>
<input type="text" id="input-id-users" placeholder="유저의 ID를 입력하세요">

<button class="run-button" onclick="fetchSpecificDatausers()">Run</button>
</div>
<div class="input-section books">
Expand All @@ -86,8 +63,7 @@ <h1>API TEST (GET)</h1>
<button class="run-button" onclick="fetchSpecificDatabooks()">Run</button>
</div>
<div class="input-section products">
<label for="input-id-products">/coupang_products/product/</label>
<input type="text" id="input-id-products" placeholder="제품의 ID를 입력하세요">

<button class="run-button" onclick="fetchSpecificDataproducts()">Run</button>
</div>
</div>
Expand All @@ -103,4 +79,4 @@ <h2>Guide</h2>
</div>
</div>
</body>
</html>
</html>
28 changes: 2 additions & 26 deletions src/view/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,6 @@ function closeModal() {
modal.style.display = 'none';
}

async function fetchData() {
try {
const userResponse = await fetch('http://34.197.44.20/admin/count');
const userData = await userResponse.json();
document.getElementById('user-count').textContent = `전체 유저 ${userData.count}명 조회`;

const bookResponse = await fetch('http://34.197.44.20/books/count');
const bookData = await bookResponse.json();
document.getElementById('book-count').textContent = `전체 책 ${bookData.count}권 조회`;

const coupangResponse = await fetch('http://34.197.44.20/coupang_products/count');
const coupangData = await coupangResponse.json();
document.getElementById('coupang-count').textContent = `전체 쿠팡 제품 ${coupangData.count}개 조회`;

} catch (error) {
console.error('데이터 가져오기 실패:', error);
}
}

async function fetchSpecificDatausers() {
const input = document.getElementById('input-id-users').value;
try {
const response = await fetch(`http://34.197.44.20/admin/user/${input}`);
const data = await response.json();
document.getElementById('result').textContent = JSON.stringify(data, null, 2);
} catch (error) {
Expand All @@ -43,7 +20,7 @@ async function fetchSpecificDatausers() {
async function fetchSpecificDatabooks() {
const input = document.getElementById('input-id-books').value;
try {
const response = await fetch(`http://localhost:5000/books/info/${input}`);

const data = await response.json();
document.getElementById('result').textContent = JSON.stringify(data, null, 2);
} catch (error) {
Expand All @@ -54,7 +31,7 @@ async function fetchSpecificDatabooks() {
async function fetchSpecificDataproducts() {
const input = document.getElementById('input-id-products').value;
try {
const response = await fetch(`http://34.197.44.20/coupang_products/product/${input}`);

const data = await response.json();
document.getElementById('result').textContent = JSON.stringify(data, null, 2);
} catch (error) {
Expand Down Expand Up @@ -88,4 +65,3 @@ document.addEventListener('DOMContentLoaded', function() {
});
});

window.onload = fetchData;

0 comments on commit 48c251a

Please sign in to comment.