Skip to content

Commit

Permalink
initial structure (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
FloEdelmann committed Feb 23, 2017
1 parent c3f13d6 commit 45ff453
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 183 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ npm-debug.log
*.env
*.dev
.DS_Store
*.sublime-*

# Docker
Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ node_js:
- "4"
cache:
directories:
- node_modules # cache NPM dependencies
- node_modules # cache NPM dependencies
35 changes: 23 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var express = require('express');
var cool = require('cool-ascii-faces');
var app = express();

app.set('port', (process.env.PORT || 5000));
Expand All @@ -11,23 +10,35 @@ app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.get('/', function(request, response) {
response.render('pages/index');
response.render('pages/index', {
title: 'Open Fixture Library'
});
});

app.get('/cool', function(request, response) {
response.send(cool());
app.get('/about', function(request, response) {
response.render('pages/about', {
title: 'About - Open Fixture Library'
});
});

app.get('/times', function(request, response) {
var result = ''
var times = process.env.TIMES || 5
for (i=0; i < times; i++)
result += i + ' ';
response.send(result);
app.get('/search', function(request, response) {
response.render('pages/search', {
title: 'Search - Open Fixture Library'
});
});

app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
app.get('/manufacturers', function(request, response) {
response.render('pages/manufacturers', {
title: 'Manufacturers - Open Fixture Library'
});
});

app.get('/categories', function(request, response) {
response.render('pages/categories', {
title: 'Categories - Open Fixture Library'
});
});

app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
Binary file removed public/lang-logo.png
Binary file not shown.
17 changes: 0 additions & 17 deletions public/node.svg

This file was deleted.

Empty file added public/style.css
Empty file.
27 changes: 0 additions & 27 deletions public/stylesheets/main.css

This file was deleted.

6 changes: 6 additions & 0 deletions views/pages/about.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% include ../partials/header.ejs %>

<h1>About</h1>
<p><em>Open Fixture Library</em> is a project by Florian Edelmann. It is <a href="http://github.com/FloEdelmann/open-fixture-library/">open source</a> (licensed under <a href="https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)" title="Gnu General Public License v3">GPL-3</a>) and everybody is invited to contribute!</p>

<% include ../partials/footer.ejs %>
6 changes: 6 additions & 0 deletions views/pages/categories.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% include ../partials/header.ejs %>

<h1>Categories</h1>
<p>list of all categories</p>

<% include ../partials/footer.ejs %>
24 changes: 0 additions & 24 deletions views/pages/db.ejs

This file was deleted.

69 changes: 4 additions & 65 deletions views/pages/index.ejs
Original file line number Diff line number Diff line change
@@ -1,67 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<% include ../partials/header.ejs %>
<title>Open Fixture Library</title>
</head>
<% include ../partials/header.ejs %>

<body>
<h1>Open fixture library</h1>
<p>Home page</p>

<% include ../partials/nav.ejs %>

<div class="jumbotron text-center">
<div class="container">
<a href="/" class="lang-logo">
<img src="/lang-logo.png">
</a>
<h1>Open Fixture Library</h1>
<p>This is a sample Node application deployed to Heroku. It's a reasonably simple app - but a good foundation for understanding how to get the most out of the Heroku platform.</p>
<a type="button" class="btn btn-lg btn-default" href="https://devcenter.heroku.com/articles/getting-started-with-nodejs"><span class="glyphicon glyphicon-flash"></span> Getting Started with Node</a>
<a type="button" class="btn btn-lg btn-primary" href="https://github.com/heroku/node-js-getting-started"><span class="glyphicon glyphicon-download"></span> Source on GitHub</a>
</div>
</div>
<div class="container">
<div class="alert alert-info text-center" role="alert">
To deploy your own copy, and learn the fundamentals of the Heroku platform, head over to the <a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs" class="alert-link">Getting Started with Node on Heroku</a> tutorial.
</div>
<hr>
<div class="row">
<div class="col-md-6">
<h3><span class="glyphicon glyphicon-info-sign"></span> How this sample app works</h3>
<ul>
<li>This app was deployed to Heroku, either using Git or by using <a href="https://github.com/heroku/node-js-getting-started">Heroku Button</a> on the repository.</li>

<li>When Heroku received the source code, it fetched all the dependencies in the <a href="https://github.com/heroku/node-js-getting-started/blob/master/package.json">package.json</a>, creating a deployable slug.</li>
<li>The platform then spins up a dyno, a lightweight container that provides an isolated environment in which the slug can be mounted and executed.</li>
<li>You can scale your app, manage it, and deploy over <a href="https://addons.heroku.com/">150 add-on services</a>, from the Dashboard or CLI.</li>
</ul>
</div>
<div class="col-md-6">
<h3><span class="glyphicon glyphicon-link"></span> Next Steps</h3>
<ul>
<li>If you are following the <a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs">Getting Started</a> guide, then please head back to the tutorial and follow the next steps!</li>
<li>If you deployed this app by deploying the Heroku Button, then in a command line shell, run:</li>
<ul>
<li><code>git clone https://github.com/heroku/node-js-getting-started.git</code> - this will create a local copy of the source code for the app</li>
<li><code>cd node-js-getting-started</code> - change directory into the local source code repository</li>
<li><code>heroku git:remote -a &lt;your-app-name></code> - associate the Heroku app with the repository</li>
<li>You'll now be set up to run the app locally, or <a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs#push-local-changes">deploy changes</a> to Heroku</li>
</ul>
</ul>
<h3><span class="glyphicon glyphicon-link"></span> Helpful Links</h3>
<ul>
<li><a href="https://www.heroku.com/home">Heroku</a></li>
<li><a href="https://devcenter.heroku.com/">Heroku Dev Center</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs">Getting Started with Node on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/deploying-nodejs">Deploying Node Apps on Heroku</a></li>
</ul>
</div>
</div> <!-- row -->
<div class="alert alert-info text-center" role="alert">
Please do work through the Getting Started guide, even if you do know how to build such an application. The guide covers the basics of working with Heroku, and will familiarize you with all the concepts you need in order to build and deploy your own apps.
</div>
</div>


</body>
</html>
<% include ../partials/footer.ejs %>
6 changes: 6 additions & 0 deletions views/pages/manufacturers.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% include ../partials/header.ejs %>

<h1>Manufacturers</h1>
<p>list of all manufacturers</p>

<% include ../partials/footer.ejs %>
6 changes: 6 additions & 0 deletions views/pages/search.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% include ../partials/header.ejs %>

<h1>Search</h1>
<p>search results</p>

<% include ../partials/footer.ejs %>
2 changes: 2 additions & 0 deletions views/partials/footer.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
</body>
</html>
26 changes: 22 additions & 4 deletions views/partials/header.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="/stylesheets/main.css" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><%= title %></title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<header>
<a href="/" class="home-logo">Open Fixture Library</a>

<form action="/search">
<input type="search" name="q" placeholder="Search fixture" />
<button type="submit">Search</button>
</form>

<ul>
<li><a href="/manufacturers">Manufacturers</a></li>
<li><a href="/categories">Categories</a></li>
<li><a href="/about">About</a></li>
</ul>
</header>
33 changes: 0 additions & 33 deletions views/partials/nav.ejs

This file was deleted.

0 comments on commit 45ff453

Please sign in to comment.