Skip to content

Instantly share code, notes, and snippets.

@gotjosh
Last active December 16, 2015 16:19
Show Gist options
  • Select an option

  • Save gotjosh/5462561 to your computer and use it in GitHub Desktop.

Select an option

Save gotjosh/5462561 to your computer and use it in GitHub Desktop.
Node controller.
index: function (req,res) {
api_url = api_base_url + '/sandwiches';
request.get(api_url, function(error, response, body){
if (!error && response.statusCode == 200) {
var sandwiches = body;
console.log(sandwiches);
res.view(sandwiches);
} else {
console.log(error);
};
});
// This will render the view: /Users/gotjosh/node/sandwich-node/views/sandwich/index.ejs
}
@gotjosh
Copy link
Author

gotjosh commented Apr 25, 2013

Error: Cannot find module './blueprints/error'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/usr/local/share/npm/lib/node_modules/sails/lib/configuration/express.js:40:4)
at Object.app.registerErrorHandlers as handle
at IncomingMessage.next (/usr/local/share/npm/lib/node_modules/sails/node_modules/connect/lib/http.js:198:17)
at ServerResponse.res.render (/usr/local/share/npm/lib/node_modules/sails/node_modules/express/lib/view.js:328:16)
at ServerResponse.module.exports.res.view (/usr/local/share/npm/lib/node_modules/sails/lib/router/request.js:71:7)
at SandwichController.index (/Users/gotjosh/node/sandwich-node/api/controllers/SandwichController.js:25:7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment