aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2021-07-23 23:38:35 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2021-07-23 23:38:35 +0100
commit32ec9fa454e1d6a670d8b7fe193458d59b62ca63 (patch)
tree4ba69d2e7e8ce03afa12e0f1edffc41fb3bb332b
parentcc2f78d27b111d21ce385214ddeaa9376175d034 (diff)
downloadnumberdisplay-32ec9fa454e1d6a670d8b7fe193458d59b62ca63.tar.gz
numberdisplay-32ec9fa454e1d6a670d8b7fe193458d59b62ca63.tar.bz2
numberdisplay-32ec9fa454e1d6a670d8b7fe193458d59b62ca63.zip
(Server)+index.html landing page with support in app
-rw-r--r--Server/Main.hs8
-rw-r--r--Server/pages/index.html35
2 files changed, 42 insertions, 1 deletions
diff --git a/Server/Main.hs b/Server/Main.hs
index bed3de5..8954d6d 100644
--- a/Server/Main.hs
+++ b/Server/Main.hs
@@ -2,6 +2,7 @@
module Main where
import Data.List
+import Data.ByteString.Lazy (fromStrict)
import Text.Printf
import Network.Wai
import Network.HTTP.Types
@@ -15,6 +16,11 @@ app request respond = respond $
index :: Response
index =
+ responseFile status200
+ [("Content-Type", "text/html;charset=UTF-8")]
+ "pages/index.html"
+ Nothing
+
responseLBS status200
[("Content-Type", "text/plain")]
"Hello, world!"
@@ -22,7 +28,7 @@ index =
errorResponse :: Response
errorResponse =
responseFile status200
- [("Content-Type", "text/plain")]
+ [("Content-Type", "text/html;charset=UTF-8")]
"pages/error.html"
Nothing
diff --git a/Server/pages/index.html b/Server/pages/index.html
new file mode 100644
index 0000000..0358ac6
--- /dev/null
+++ b/Server/pages/index.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class='no-js' lang=''>
+ <head>
+ <meta charset='utf-8'>
+ <meta http-equiv='x-ua-compatible' content='ie=edge'>
+ <title>NumberDisplay - Error</title>
+ <meta name='description' content='Error page for NumberDisplay program'>
+ <meta name='author' content='Aryadev Chavali'/>
+ <meta name='viewport' content='width=device-width, initial-scale=1'>
+
+ <link rel='apple-touch-icon' href='/apple-touch-icon.png'>
+ <link rel='shortcut icon' href='/favicon.ico'/>
+ <!-- Place favicon.ico in the root directory -->
+ <style>
+ #form {
+ width:50%;
+ display:grid;
+ grid-template-columns:10fr 1fr
+ }
+ </style>
+ </head>
+ <body>
+ <!--[if lt IE 8]>
+ <p class='browserupgrade'>
+ You are using an <strong>outdated</strong> browser. Please
+ <a href='http://browsehappy.com/'>upgrade your browser</a> to improve
+ your experience.
+ </p>
+ <![endif]-->
+ <form id="form" action="/input">
+ <input name="number" type="text" value=""/>
+ <button>Enter</button>
+ </form>
+ </body>
+</html>