Skip to content

Commit

Permalink
Mustakim & Shubham - created initial setup.
Browse files Browse the repository at this point in the history
What changes have you made?

* created server and homepage.
  • Loading branch information
mustakip committed Feb 18, 2019
1 parent 93acb43 commit d51d7e8
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 40 deletions.
50 changes: 39 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"cookie-parser": "^1.4.4",
"express": "^4.16.4",
"nodemon": "^1.18.10"
},
Expand Down
20 changes: 20 additions & 0 deletions public/pages/homepage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<head>
<title>Cash Flow</title>
<link rel="stylesheet" type="text/css" href="/homepage.css" />
</head>
<body>
<header>Cash Flow
<p>Get out of the Rat Race !</p>
</header>
<main>
<section id="gameOptionsField" class="game-options-field">
<button id="hostGame" class="game-options">Host Game</button>
<button id="joinGame" class="game-options">Join Game</button>
<button id="instructions" class="game-options">Instructions</button>
<button id="about" class="game-options">About</button>
</section>
<section class="logo">Image</section>
</main>
</body>
</html>
54 changes: 54 additions & 0 deletions public/stylesheets/homepage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
html,
body {
width: 100%;
height: 100%;
}
header {
font-size: 40px;
height: 20%;
text-align: center;
}
p {
font-size: 30px;
}
main {
height: 80%;
width: 100%;
border: 1px solid black;
display: flex;
justify-content: space-around;
align-items: center;
}
.game-options-field {
width: 40%;
height: 80%;
border: 1px solid black;
border-radius: 5%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
box-shadow: 10px 10px 10px rgb(128, 124, 124);
}
.logo {
width: 40%;
height: 80%;
border: 1px solid black;
border-radius: 5%;
box-shadow: 10px 10px 10px rgb(128, 124, 124);
}
.game-options {
width: 50%;
height: 10%;
border-radius: 50vmax;
margin: 10px;
font-size: 20px;
box-shadow: 10px 10px 10px rgb(128, 124, 124);
}
.player-name {
width: 50%;
height: 10%;
border-radius: 25%;
margin: 10px;
font-size: 20px;
}
8 changes: 8 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const http = require('http');
const app = require('./src/app.js');

const server = http.createServer(app);
const PORT = process.env.PORT || 8081;
server.listen(PORT);

console.log('Server listening at port ', PORT);
29 changes: 0 additions & 29 deletions spikes/homepage/homepage.html

This file was deleted.

10 changes: 10 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const express = require('express');
const app = express();
const {renderHomePage, logRequest} = require('./handlers.js');

app.use(logRequest);
app.get('/', renderHomePage);
app.use(express.static('public/pages'));
app.use(express.static('public/scripts'));
app.use(express.static('public/stylesheets'));
module.exports = app;
11 changes: 11 additions & 0 deletions src/handlers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const renderHomePage = function(req, res) {
res.redirect('/homepage.html');
};

const logRequest = function(req, res, next) {
console.log('URL --> ', req.url);
console.log('Method --> ', req.method);
next();
};

module.exports = {renderHomePage, logRequest};

0 comments on commit d51d7e8

Please sign in to comment.