Permalink
Browse files

Para un prototipado rapido se usa jsonreq y asi botar el json al clie…

…nt side para futura modificacion, tambien incluye la conexion a la app.db con mongoose
  • Loading branch information...
1 parent 5c3802b commit 1fdb0824e82ad33ff15d6ad19ebe38e864d84dac arpunk committed Jun 7, 2011
Showing with 14 additions and 6 deletions.
  1. +5 −3 package.json
  2. +9 −3 server.js
View
@@ -3,7 +3,9 @@
, "version": "0.0.1"
, "private": true
, "dependencies": {
- "express": "2.3.11"
- , "jade": ">= 0.0.1"
+ "express": "= 2.3.11"
+ , "mongoose": "= 1.3.7"
+ , "jsonreq": "=> 0.1.0"
+ , "jade": "= 0.12.1"
}
-}
+}
View
@@ -4,6 +4,8 @@
*/
var express = require('express');
+var mongoose = require('mongoose');
+var btcPrices = require('jsonreq');
var app = module.exports = express.createServer();
@@ -20,18 +22,22 @@ app.configure(function(){
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+ app.set('db-uri', 'mongodb://localhost/btcfb-development');
});
app.configure('production', function(){
app.use(express.errorHandler());
+ app.set('db-uri', 'mongodb://btcfb:t3st1ng@localhost/btcfb-production');
});
+app.db = mongoose.connect(app.set('db-uri'));
+
// Routes
app.get('/', function(req, res){
- res.render('index', {
- title: 'Bitcoin Price on Facebook'
- });
+ btcPrices.get('http://bitcoincharts.com/t/weighted_prices.json', function(err, data) {
@cronopio
cronopio Jun 7, 2011 Owner

Ja! y yo disque haciendolo en node puro

+ res.send(data);
+ })
});
app.listen(3000);

0 comments on commit 1fdb082

Please sign in to comment.