Created
April 27, 2012 11:23
-
-
Save jeffdonthemic/2508501 to your computer and use it in GitHub Desktop.
Force.com Node.js Demo - routes/index.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
// only needed if calling the rest api from this file (accounts route) | |
var rest = rest = require('./../rest.js'); | |
/* | |
* GET home page. | |
*/ | |
exports.index = function(req, res){ | |
res.render('index', { title: 'Salesforce.com Node.js REST Demo' }) | |
}; | |
/* | |
* GET list of accounts - for larger apps, you may want to separate | |
* code into different routes for ease of maintenance and logic. | |
* Prevents app.js from becoming huge! | |
*/ | |
exports.accounts = function(req, res){ | |
rest.api(req).query("select id, name from account limit 10", function(data) { | |
res.render("accounts", { title: 'Accounts', data: data, user: req.session.identity } ); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment