Being new to MongoDB and Mongoose, I feel really lost here.
After trying soooo many ways, I'm stuck with this: I can't figure out how Mongoose actually works, I went back to original state for clearer code reading, my tryouts are crashing node.JS.
I have this in the app.js that works:
PolyModel.find(null, function (err, poly) {
if (err) { throw err; }
console.log(poly);
});
Console shows good results in the shell, using a nice JSON format.
This line sends everything to the router
app.use('/', index);
My router:
var express = require('express');
var router = express.Router();
router.get('/', function(req, res, next) {
res.render('index', { title: 'Polygon grid', author: 'Author'});
});
module.exports = router;
My main question is: how do I get this poly value in the router / views?
I've red so much stuff and would like to learn the proper practices.
For information, my final goal would be to get this value into an Angular ng-repeat.
via Sunkhern
No comments:
Post a Comment