I'm writing a quick prototype using MongoDB. I'm trying to setup a quick webview using angularJS and the built in rest service from MongoDB. For viewing the website I haven't setup any artificial server I'm using the WebStorm built in server.
I'm starting MongoDB with the following parameters
mongod --rest
And I'm getting the following error in the mongod console
[websvr] don't know how to handle a [OPTIONS]
My angularJS controller:
var csrMap = angular.module('app', []);
csrMap.controller('AppCtrl', function AppCtrl($scope, $http) {
$http.get('http://localhost:28017/test/foo/').success(function(data) {
$scope.foo = data;
});
});
my html file
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
<title></title>
<script src="js/angular.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-controller="AppCtrl">
<ul>
<li ng-repeat="alert in foo.rows">
{{alert.timestamp | date:'dd.MM.yy HH:mm'}}: {{alert.alertMessage}}
</li>
</ul>
</body>
</html>
I i parse the json data in a local file and read it from there, it works great, here is a snippet:
{
"offset" : 0,
"rows": [
{ "_id" : { "$oid" : "525ef21e89806dfa17cef146" }, "timestamp" : 1381954078346, "alertMessage" : "foo" } ,
{ "_id" : { "$oid" : "525ef21e89806dfa17cef147" }, "timestamp" : 1381954078381, "alertMessage" : "foobar" } ,
],
"total_rows" : 688 ,
"query" : {} ,
"millis" : 25
}
I can also call the rest service in firefox and get the appropriate response.
I'd be grateful for any help. I've searched google up and down, but I haven't found any material on that error...
$http.get('http://localhost:28017/test/foo/').error(function(data) { $scope.foo = "error"; });
I can printout foo – minime Oct 21 '13 at 12:34