Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup/Config Question(s) #55

Open
aaronfischer opened this issue Jan 17, 2018 · 0 comments
Open

Setup/Config Question(s) #55

aaronfischer opened this issue Jan 17, 2018 · 0 comments

Comments

@aaronfischer
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant