npm.io
2.0.0 • Published 8 years ago

apollo-module-authentication

Licence
MIT
Version
2.0.0
Deps
6
Size
136 kB
Vulns
26
Weekly
0

Introduction

Connector for mongodb for apollo. It also includes the base model for all context models.

This module is built in ES6 with no transpilation for easier debugging. You have to use Node 6+ to use it.

import { MongoConnector } from 'apollo-connector-mongodb');

const mongoURL = 'mongodb://localshot:27017/test';

const conn = new MongoConnector(mongoURL, () => {
  
  //init express and apollo
  const context = initContext(conn);
  const config = {
    schema,
    pretty : true,
    context
  };

  // launches a new express instance
  startExpress(config);
});

Model

class User extends BaseModel {
  method() {
    this.collection.find() ... // mogodb collection
  }
}

Keywords