envanter-dokuman/public/index.html

79 lines
4.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Envanter API Belgeleri</title>
<link rel="stylesheet" href="/css/style.css">
<style>
.api-section { margin-bottom: 1.5rem; }
.method { display:inline-block; width:60px; font-weight:700; padding:.15rem .4rem; border-radius:5px; font-size:.8rem; text-align:center; }
.get { background:#dcfce7; color:#15803d; }
.post { background:#dbeafe; color:#1d4ed8; }
.put { background:#fef3c7; color:#b45309; }
.del { background:#fee2e2; color:#b91c1c; }
.endpoint { font-family:monospace; background:#f1f5f9; padding:.55rem .8rem; border-radius:6px; margin:.35rem 0; }
.endpoint code { font-weight:600; }
.desc { color:var(--muted); font-size:.9rem; margin-left:70px; }
code { background:#f1f5f9; padding:.1rem .35rem; border-radius:4px; }
.nav-clean { margin-bottom:1.5rem; }
</style>
</head>
<body>
<header class="topbar"><div class="container topbar-inner">
<a href="/" class="brand">📦 Envanter Yönetimi</a>
<nav class="nav">
<a href="/">Panele dön</a>
<a href="/api/products">Ürünler</a>
<a href="/api/reports/category">Raporlar</a>
</nav>
</div></header>
<main class="container">
<div class="page-head"><h1>API Uçları</h1><p class="muted">REST API kullanım belgeleri</p></div>
<section class="api-section card">
<h2>Ürünler</h2>
<div class="endpoint"><span class="method get">GET</span> <code>/api/products</code><span class="desc">Tüm ürünler (sayfa görünümü)</span></div>
<div class="endpoint"><span class="method get">GET</span> <code>/api/products/api/all</code><span class="desc">JSON ürün listesi</span></div>
<div class="endpoint"><span class="method post">POST</span> <code>/api/products</code><span class="desc">Yeni ürün ekle</span></div>
<div class="endpoint"><span class="method get">GET</span> <code>/api/products/:id</code><span class="desc">Ürün detayı + hareket geçmişi</span></div>
<div class="endpoint"><span class="method put">PUT</span> <code>/api/products/:id</code><span class="desc">Ürünü güncelle</span></div>
<div class="endpoint"><span class="method del">DELETE</span> <code>/api/products/:id</code><span class="desc">Ürünü sil</span></div>
</section>
<section class="api-section card">
<h2>Stok Hareketleri</h2>
<div class="endpoint"><span class="method post">POST</span> <code>/api/stock/in</code><span class="desc">Stok girişi <code>{productId, quantity, note?}</code></span></div>
<div class="endpoint"><span class="method post">POST</span> <code>/api/stock/out</code><span class="desc">Stok çıkışı (yetersizse 400)</span></div>
<div class="endpoint"><span class="method get">GET</span> <code>/api/stock/movements?json=1</code><span class="desc">Tüm hareket logları</span></div>
<div class="endpoint"><span class="method get">GET</span> <code>/api/stock/movements/:productId</code><span class="desc">Ürüne özel hareketler</span></div>
</section>
<section class="api-section card">
<h2>Kategoriler</h2>
<div class="endpoint"><span class="method get">GET</span> <code>/api/categories?json=1</code><span class="desc">Tüm kategoriler + ürün sayısı</span></div>
<div class="endpoint"><span class="method post">POST</span> <code>/api/categories</code><span class="desc">Kategori ekle <code>{name}</code></span></div>
<div class="endpoint"><span class="method put">PUT</span> <code>/api/categories/:id</code><span class="desc">Kategori güncelle</span></div>
<div class="endpoint"><span class="method del">DELETE</span> <code>/api/categories/:id</code><span class="desc">Kategori sil (ürünü varsa engellenir)</span></div>
</section>
<section class="api-section card">
<h2>Raporlar</h2>
<div class="endpoint"><span class="method get">GET</span> <code>/api/reports/api/category/:id?from=&to=</code><span class="desc">Kategori bazlı JSON rapor (<code>id=all</code> tümü)</span></div>
<div class="endpoint"><span class="method get">GET</span> <code>/api/reports/api/all</code><span class="desc">Tüm kategori özetleri</span></div>
<div class="endpoint"><span class="method get">GET</span> <code>/api/reports/category</code><span class="desc">Raporlama sayfası</span></div>
</section>
<section class="card">
<h2>Örnek — Stok Girişi</h2>
<pre><code>curl -X POST http://localhost:3000/api/stock/in \
-H "Content-Type: application/json" \
-d '{"productId": 1, "quantity": 10, "note": "Tedarikçi sevkiyatı"}'</code></pre>
</section>
<p><a href="/" class="btn btn-primary">← Panele Dön</a></p>
</main>
</body>
</html>