feat: add index with information about available endpoint

This commit is contained in:
Urko 2023-07-20 08:42:04 +02:00
parent ff67907407
commit dd4765b306
3 changed files with 91 additions and 1 deletions

90
cmd/http/views/index.hbs Normal file
View File

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BTC Pay Checker</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header {
background: #50b3a2;
color: white;
padding-top: 30px;
min-height: 70px;
border-bottom: #e8491d 3px solid;
}
header a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
header li {
float: left;
display: inline;
padding: 0 20px 0 20px;
}
header #branding {
float: left;
}
header #branding h1 {
margin: 0;
}
header nav {
float: right;
margin-top: 10px;
}
header .highlight, header .current a {
color: #e8491d;
font-weight: bold;
}
header a:hover {
color: #cccccc;
font-weight: bold;
}
</style>
</head>
<body>
<header>
<div class="container">
<div id="branding">
<h1><span class="highlight">BTC</span> Pay Checker</h1>
</div>
<nav>
<ul>
<li class="current"><a href="index.html">Home</a></li>
</ul>
</nav>
</div>
</header>
<div class="container">
<h2>How to use the /order POST endpoint</h2>
<p>This endpoint allows you to create a new order. It requires a JSON body with the following fields:</p>
<ul>
<li><strong>order_id:</strong> The ID of the order.</li>
<li><strong>client_id:</strong> The ID of the client.</li>
<li><strong>amount:</strong> The amount in USD that the client wants to pay.</li>
<li><strong>currency:</strong> The currency in which the payment will be made. This should be a valid FiatCurrency value.</li>
<li><strong>client_email:</strong> The email of the client.</li>
</ul>
<p>The endpoint will return a JSON response with the following fields:</p>
<ul>
<li><strong>order_id:</strong> The ID of the order.</li>
<li><strong>amount:</strong> The amount in BTC that the client needs to pay.</li>
<li><strong>wallet_address:</strong> The wallet address to which the payment should be made.</li>
<li><strong>expires_at:</strong> The time at which the order will expire.</li>
</ul>
</div>
</body>
</html>

View File

@ -138,7 +138,7 @@ func (s *RestServer) loadViews(imagesDir string) {
s.app.Static("/images", imagesDir)
s.app.Get("/", func(c *fiber.Ctx) error {
return c.Render("upload", fiber.Map{})
return c.Render("index", fiber.Map{})
})
s.app.Get("/error", func(c *fiber.Ctx) error {