Browse Source

Added 500 error page

kanadeko 7 years ago
parent
commit
79e786f3b8
2 changed files with 50 additions and 1 deletions
  1. 3 1
      lolisafe.js
  2. 47 0
      pages/error/500.html

+ 3 - 1
lolisafe.js

@@ -39,7 +39,9 @@ safe.use(function (req, res, next) {
 })
 
 safe.use(function (err, req, res, next) {
-	res.status(500).end()
+	res.status(500).sendFile('500.html', {
+		root: './pages/error/',
+	})
 })
 
 safe.listen(config.port, () => console.log(`loli-safe started on port ${config.port}`))

+ 47 - 0
pages/error/500.html

@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>loli-safe</title>
+
+        <link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
+
+        <style>
+            html, body {
+                height: 100%;
+            }
+
+            body {
+                margin: 0;
+                padding: 0;
+                width: 100%;
+                color: #B0BEC5;
+                display: table;
+                font-weight: 100;
+                font-family: 'Lato';
+            }
+
+            .container {
+                text-align: center;
+                display: table-cell;
+                vertical-align: middle;
+            }
+
+            .content {
+                text-align: center;
+                display: inline-block;
+            }
+
+            .title {
+                font-size: 72px;
+                margin-bottom: 40px;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="container">
+            <div class="content">
+                <div class="title">Internal server error.</div>
+            </div>
+        </div>
+    </body>
+</html>