-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
I'll preface this with I'm new to mongo/express/jsonapi-server/etc.
I've setup the jsonapi-server using the MemoryHandler with examples:[...] successfully. However, I want to actually set things up using an actual DB so I've chosen mongo.
I'm not entirely sure what is required by this package though, but I setup a DB through "mLab" and my jsonApi.define looks something like this now:
...
var MongoStore = require('jsonapi-store-mongodb');
var port = 3000;
var jsonApiRouter = new express.Router();
jsonApi.setConfig({
router: jsonApiRouter,
graphiql: false,
});
app.use('/', jsonApiRouter);
jsonApi.define({
resource: 'drinks',
// handlers: new jsonApi.MemoryHandler(),
handlers: new MongoStore({
url: 'mongodb://<user>:<pass>@123456.mlab.com:59117/wedrinkin_db',
}),
...Beyond this, I'm not sure what else is required. Obviously when I visit: http://localhost:3000/drinks I don't see any data, even though I have loaded a few documents into a "drinks" collection/db on mLab. I also don't see any errors though.
Any advice/tips are helpful!
Metadata
Metadata
Assignees
Labels
No labels