2014년 12월 29일 월요일

[AngularJS] Re: Angular + Mongoose + Node: keine DB-Einträge

first, it would be helpful to post in English to maximise the chance to get a response. 
Second, and even more important you are unlikely to get a response if you are not providing any idea on the client code. Just posting the server side code does not help. The server side as such looks ok, at least for the part provded. Simply check your server API with postman or similar tools to eliminate any server issues.

On Sunday, December 28, 2014 12:58:08 PM UTC+1, Thomas Handle wrote:
Hallo zusammen,

dies ist mein erster Eintrag hier. Habe gerade begonnen, mich in die oben genannten Themen einzuarbeiten und brauche eure Unterstützung. Ich habe ein Model erstellt:

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ArticleCategory = mongoose.model('ArticleCategory', {
    
DisplayName: String, //
    
Published: Date,
    commentsAllowed
: Boolean,
    
Visibility: Boolean,
    
AutorID: {type: Schema.ObjectId, ref: 'User'},
    
ModificationDate: Date,
    
ModificationCounter: Number,
    
LastModificationBy: {type: Schema.ObjectId, ref: 'User'}
});


und in meiner routes.js anschließend ein

module.exports = function (app, passport) {

app
.get('/api/article_categories', function (req, res) {
        
ArticleCategory.find(function (err, article_categories) {
            
if (err) {
                res
.send(err);
            
}
            res
.json(article_categories);
        
});
    
});
});


Wenn ich jetzt aber die Seite über localhost/api/article_categories lade erhalte ich nur ein leeres [ ].
Keine Einträge im Error-Log...

Woran liegts? Was mache ich evtl. falsch?



Have you tried
ArticleCategory. Find ({}, function   (Err ...


댓글 없음:

댓글 쓰기