I am a beginner. I installed Bitnami MEAN stack and I have a question.
"[]"
shows on the web page when I enter http://127.0.0.1:3000/tableList.
I want to know why the web page does not show the data in collections.
On Command Prompt:
C:\Bitnami\meanstack-3.2.3-1\test>SET DEBUG=test:* & npm start
test@0.0.0 start C:\Bitnami\meanstack-3.2.3-1\test node ./bin/www test:server Listening on port 3000 +0ms connection successful [] GET /tableList 304 30.004 ms - - GET /favicon.ico 200 7.164 ms - 1183
On mongodb.log
file:
2016-04-05T00:08:04.350+0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:52192 #6 (4 connections now open)
2016-04-05T00:08:04.513+0700 I ACCESS [conn6] Successfully authenticated as principal chai on khamoo
On app.js
file:
var mongoose = require('mongoose');
mongoose.connect('mongodb://chai:chai@localhost/khamoo', function(err) {
if(err) {
console.log('connection error', err);
} else {
console.log('connection successful');
}
});
mongoose.model('tableList',{tid: String});
app.get('/tableList', function(req, res) {
mongoose.model('tableList').find(function(err,tableList){
console.log(tableList);
res.json(tableList);
});
});