Permalink
Browse files

Updated the app.js

  • Loading branch information...
1 parent d08b62b commit c6338956f63ea675c825983cc2da7bc4c4910c18 @stolksdorf committed Feb 7, 2014
Showing with 9 additions and 7 deletions.
  1. +3 −3 README.md
  2. +6 −4 app.js
View
@@ -11,7 +11,7 @@
- Clone it down, `git clone git@github.com:stolksdorf/sample_proj.git`
- Create a new app at Heroku
- Add it to your repo, `git remote add heroku git@heroku.com:sample_proj.git`
-- 'git push origin master` updates your github repo
+- `git push origin master` updates your github repo
- `git push origin heroku` deploys your app to Heroku
@@ -24,7 +24,7 @@
- `npm install mongoose --save`
- `npm install underscore --save`
- Add MongoDB to your project. `heroku addons:add mongohq`
-- Copy in `modules`, `public`, `views`, app.js`, `Procfile`
+- Copy in `modules`, `public`, `views`, `app.js`, and `Procfile`
###Run your App
- `node app.js` will start your server listening on port 5000
@@ -42,7 +42,7 @@
- `node_modules` - Code for the node packages we pulled in using `npm` are stored here. Don't touch.
- `app.js` - Our heart of our apllication. Setups up our server and declares any resources we need.
- `package.json` - Machine readable description of our project. Let's Heroku know what it should do with the project.
-- 'Procfile' - Command(s) that Heroku will run when it spins up a dyno.
+- `Procfile` - Command(s) that Heroku will run when it spins up a dyno.
###Client Side
View
10 app.js
@@ -51,10 +51,12 @@ app.get('/', function(req,res){
});
app.get('/thing/:thingid', function(req,res){
- res.end(render('thingPage.html', {
- test : 'wooo',
- gifs : 'wooooooo'
- }));
+ Things.findById(req.params.thingid, function(err, thing){
+ if(err || !thing) return res.send(500, "Can't find thing");
+ res.end(render('thingPage.html', {
+ thing : JSON.stringify(thing)
+ }));
+ });
});
app.get('*', function(req,res){

0 comments on commit c633895

Please sign in to comment.