Skip to content

Commit

Permalink
Set up application structure
Browse files Browse the repository at this point in the history
Ran into the weirdest problem loading static files, but rebuilding the server
piece by piece until it exactly matched the first attempt made it go away. I
have no idea what was broken.
  • Loading branch information
kristjan committed Apr 6, 2012
1 parent 343a05c commit f59c978
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules/
config_env
1 change: 1 addition & 0 deletions Procfile
@@ -0,0 +1 @@
web: node githud.js
5 changes: 5 additions & 0 deletions app/routes.js
@@ -0,0 +1,5 @@
exports.init = function(app) {
app.get('/', function(req, res) {
res.render('index.ejs');
});
};
31 changes: 31 additions & 0 deletions app/server.js
@@ -0,0 +1,31 @@
var express = require('express')
, everyauth = require('everyauth')
, routes = require('./routes')
;

var app = express.createServer();
app.configure(function() {
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({
secret: process.env.SESSION_SECRET
}));
app.use(everyauth.middleware());
app.use(express.static(__dirname + "/../public"));
});

app.configure('development', function() {
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
});

everyauth.helpExpress(app);
routes.init(app);

var port = process.env.PORT || 4483;
app.listen(port, function() {
console.log("HUD up on", port);
});
1 change: 1 addition & 0 deletions githud.js
@@ -0,0 +1 @@
var server = require('./app/server');
23 changes: 23 additions & 0 deletions package.json
@@ -0,0 +1,23 @@
{
"author": "Kristján Pétursson <kristjan@gmail.com>",
"name": "GitHud",
"description": "A JavaScript layer on top of GitHub Issues",
"version": "0.0.1",

"repository": {
"url": "https://github.com/kristjan/githud"
},

"engines": {
"node": ">0.6.5"
},

"dependencies": {
"ejs" : ">=0.7.1",
"everyauth": ">=0.2.30",
"express" : ">=2.5.8"
},

"devDependencies": {},
"optionalDependencies": {}
}
13 changes: 13 additions & 0 deletions public/js/githud.js
@@ -0,0 +1,13 @@
if (typeof GitHUD === 'undefined') GitHUD = {};

GitHUD.Core = (function() {
function init() {
console.log("OK");
}

return {
init : init
};
})();

$(GitHUD.Core.init);
1 change: 1 addition & 0 deletions views/index.ejs
@@ -0,0 +1 @@
OK
14 changes: 14 additions & 0 deletions views/layout.ejs
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>GitHUD</title>
</head>
<body>
<h1>GitHUD</h1>
<%= body %>
</body>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript" src="/js/githud.js"></script>
</html>

0 comments on commit f59c978

Please sign in to comment.