diff --git a/pages/home.html b/pages/home.html index a38b6d4..9b1eae1 100644 --- a/pages/home.html +++ b/pages/home.html @@ -9,6 +9,7 @@

Logged in.

Back home + Log Out
diff --git a/pages/logout.html b/pages/logout.html new file mode 100644 index 0000000..3c26f84 --- /dev/null +++ b/pages/logout.html @@ -0,0 +1,14 @@ + + + + + Logged Out + + + +
+

Logged Out

+ Go Back To Landing +
+ + diff --git a/pages/wronginfo.html b/pages/wronginfo.html new file mode 100644 index 0000000..16c4371 --- /dev/null +++ b/pages/wronginfo.html @@ -0,0 +1,14 @@ + + + + + Wrong info + + + +
+

Wrong Information entered; please try again.

+ Go Back to the Landing Page. +
+ + diff --git a/server.js b/server.js index 995ab9e..f597891 100644 --- a/server.js +++ b/server.js @@ -22,7 +22,6 @@ const server = http.createServer((req, res) => { } if (req.url === "/") { - logged = "false"; res.statusCode = 200; res.setHeader("Content-Type", "text/html"); fs.readFile("pages/landing.html", function(error, data) { @@ -52,6 +51,12 @@ const server = http.createServer((req, res) => { }); } + if (req.url === "/" && logged === "true") { + res.statusCode = 200; + res.writeHead(301, { Location: "/home" }); + res.end(); + } + if (req.url === "/wrong_info") { res.statusCode = 200; res.setHeader("Content-Type", "text/html"); @@ -67,6 +72,22 @@ const server = http.createServer((req, res) => { }); } + if (req.url === "/log-out") { + logged = "false"; + res.statusCode = 200; + res.setHeader("Content-Type", "text/html"); + fs.readFile("pages/logout.html", function(error, data) { + if (error) { + res.writeHead(404); + res.write("Error: File not found."); + } else { + res.write(data); + } + + res.end(); + }); + } + if (req.url === "/members" && req.method === "POST") { res.statusCode = 200; //res.setHeader("Content-Type", "text/json");