ADDED 404
This commit is contained in:
parent
7bc98d56b5
commit
e175edcf2d
2 changed files with 70 additions and 2 deletions
4
main.go
4
main.go
|
@ -43,8 +43,8 @@ func main() {
|
|||
app.Get("/:id", func(c *fiber.Ctx) error {
|
||||
val, err := client.Get(c.Params("id")).Result()
|
||||
if err != nil {
|
||||
return c.Render("home", fiber.Map{
|
||||
"ERR": "404 URL not found",
|
||||
return c.Render("404", fiber.Map{
|
||||
"BASEURL": c.Protocol() + "://" + c.Hostname(),
|
||||
})
|
||||
}
|
||||
return c.Redirect(val)
|
||||
|
|
68
views/404.html
Normal file
68
views/404.html
Normal file
|
@ -0,0 +1,68 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Uff 404</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
|
||||
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css?family=Montserrat:300');
|
||||
|
||||
body {
|
||||
background: #3498DB;
|
||||
color: #fff;
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20vh;
|
||||
}
|
||||
|
||||
h2 span {
|
||||
font-size: 4rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
a:link,
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
h3 a:hover {
|
||||
text-decoration: none;
|
||||
background: #fff;
|
||||
color: #3498DB;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h1>:(</h1><br>
|
||||
<h2>A <span>404</span> error occured, Page not found, check the URL and try again.</h2>
|
||||
<hr>
|
||||
<h2>Ein <span>404</span> Fehler ist aufgetreten, Seite nicht gefunden, überprüfen Sie die URL und versuchen Sie es erneut.</h2>
|
||||
<hr>
|
||||
<h2><span>404</span> エラーが発生しました。ページが見つかりません。URLを確認して、再試行してください。</h2>
|
||||
<hr>
|
||||
<h2>发生 <span>404</span> 错误,找不到页面,请检查 URL 并重试。</h2>
|
||||
|
||||
<br><br>
|
||||
<h3><a href="{{ .BASEURL }}">Return to home</a> | <a href="javascript:history.back()">Go Back</a>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue