Closed htammen closed 9 years ago
Hi Helmut,
entity type should not include namespace in the model
your fixed code should look like
var http = require('http');
var Datastore = require('nedb');
var db = new Datastore( { inMemoryOnly: true });
var ODataServer = require("simple-odata-server");
var model = {
namespace: "myns",
entityTypes: {
"UserType": {
"_id": {"type": "Edm.String", key: true},
"test": {"type": "Edm.String"},
}
},
entitySets: {
"users": {
entityType: "myns.UserType"
}
}
};
var odataServer = ODataServer("http://localhost:1337")
.model(model)
.onNeDB(function(es, cb) { cb(null, db)});
http.createServer(odataServer.handle.bind(odataServer)).listen(1337);
db.insert({"_id": "1", "test": "a"});
db.insert({"_id": "2", "test": "b"});
db.insert({"_id": "3", "test": "c"});
db.insert({"_id": "4", "test": "d"});
db.insert({"_id": "5", "test": "e"});
Jan
Thank you very much Jan for this quick response, nearly real time :-). It's working :+1: Maybe you should update your example. I've copied the code from it.
Thanks Helmut
Oh, thanks. Just fixed it in the readme.
Hi, when I try to run your example from the examples folder I get the following error as soon as I try to read the users entityset.
Unfortunately I'm not able to debug with node-debug (cannot set a breakpoint, don't know why, I'm quite new to node). Any ideas whats wrong with the example / the odata-server?
Here's my code:
Best regards Helmut