Last active
December 16, 2015 16:19
-
-
Save gotjosh/5462561 to your computer and use it in GitHub Desktop.
Node controller.
This file contains hidden or 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
| 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 | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)