forked from ghofree/lab4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express'); | ||
var routes = require('./routes'); | ||
var user = require('./routes/user'); | ||
var http = require('http'); | ||
var path = require('path'); | ||
var handlebars = require('express3-handlebars') | ||
|
||
var app = express(); | ||
|
||
// all environments | ||
app.set('port', process.env.PORT || 3000); | ||
app.set('views', path.join(__dirname, 'views')); | ||
app.engine('handlebars', handlebars({defaultLayout: 'main'})); | ||
app.set('view engine', 'handlebars'); | ||
|
||
app.use(express.favicon()); | ||
app.use(express.logger('dev')); | ||
app.use(express.json()); | ||
app.use(express.urlencoded()); | ||
app.use(express.methodOverride()); | ||
app.use(express.cookieParser('Intro HCI secret key')); | ||
app.use(express.session()); | ||
app.use(app.router); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
|
||
// development only | ||
if ('development' == app.get('env')) { | ||
app.use(express.errorHandler()); | ||
} | ||
|
||
app.get('/', routes.index); | ||
app.get('/users', user.list); | ||
|
||
http.createServer(app).listen(app.get('port'), function(){ | ||
console.log('Express server listening on port ' + app.get('port')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "IntroHCI", | ||
"version": "0.0.1", | ||
"author": "Intro HCI Staff", | ||
|
||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/IntroHCI/lab4" | ||
}, | ||
"license": "MIT", | ||
|
||
"private": true, | ||
"scripts": { | ||
"start": "node app.js" | ||
}, | ||
"dependencies": { | ||
"express": "3.x", | ||
"express3-handlebars": "*", | ||
"mongodb": "*", | ||
"mongoose": "*" | ||
}, | ||
"engines": { | ||
"node": "0.10.x" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
body { | ||
padding: 50px; | ||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; | ||
} | ||
|
||
a { | ||
color: #00B7FF; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
/* | ||
* GET home page. | ||
*/ | ||
|
||
exports.index = function(req, res){ | ||
res.render('index', { title: 'Intro to HCI' }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
/* | ||
* GET users listing. | ||
*/ | ||
|
||
exports.list = function(req, res){ | ||
res.send("respond with a resource"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Example homepage</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>{{{title}}}</title> | ||
</head> | ||
<body> | ||
|
||
{{{body}}} | ||
|
||
</body> | ||
</html> |