Skip to content

Commit

Permalink
6 - Creating our Views
Browse files Browse the repository at this point in the history
  • Loading branch information
hollylawly committed Aug 30, 2016
1 parent be03162 commit 1fe4eb3
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/routes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// require express
var express = require('express');
var path = require('path');

// create our router object
var router = express.Router();
Expand All @@ -9,12 +10,12 @@ module.exports = router;

// route for our homepage
router.get('/', function(req, res) {
res.send('hello world again!');
res.sendFile(path.join(__dirname, '../index.html'));
});

// route for our about page
router.get('/about', function(req, res) {
res.send('hello world i am the about page!');
res.sendFile(path.join(__dirname, '../about.html'));
});

router.get('/contact');
Expand Down
44 changes: 44 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Node Site</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<header>
<nav class="navbar navbar-inverse">
<a href="/" class="navbar-brand">My Site</a>
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
</header>

<section class="hero">
<div class="hero-content">
<h2>Welcome to the Site!</h2>
<p>The best place to be</p>

<a href="/" class="btn btn-lg btn-primary">Get Started</a>
<a href="/contact" class="btn btn-lg btn-primary">Contact</a>
</div>
</section>

<main>
<div class="container">
<div class="jumbotron text-center">
Home Page
</div>
</div>
</main>

<footer>
Awesome Site. Copyright &copy; 2016
</footer>
</body>
</html>
55 changes: 55 additions & 0 deletions public/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
body {
font-size: 16px;
line-height: 1.5;
}

header .navbar {
border-radius: 0;
margin: 0;
}

.hero {
background-image: url(../img/planet.jpg);
background-repeat: no-repeat;;
background-size: cover;
background-position: center center;
padding: 50px 0;
min-height: 650px;
position: relative;
}

.hero-content {
position: absolute;
top: 50%;
text-align: center;
width: 100%;
}

.hero-content h2 {
color: #FFF;
font-size: 80px;
}

.hero-content p {
color: #FFF;
font-size: 40px;
margin-bottom: 30px;
}

.hero-content .btn {
border-radius: 2px;
padding: 20px 30px;
}

main {
min-height: 500px;
padding: 50px 0;
}

footer {
padding: 30px 0;
font-size: 14px;
color: #BBB;
background: #222;
text-align: center;
}
Binary file added public/img/planet.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ var port = 8080;
var router = require('./app/routes');
app.use('/', router);

// set static files (css and images, etc) location
app.use(express.static(__dirname + '/public'));

// start the server
app.listen(port, function() {
Expand Down

0 comments on commit 1fe4eb3

Please sign in to comment.