New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphql-mongodb-resolver

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-mongodb-resolver

Resolvers generator for GraphQL and MongoDB

  • 1.0.0-alpha.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

graphql-mongodb-resolver

Resolvers generator for GraphQL and MongoDB

Concept

var express = require('express');
var graphqlHTTP = require('express-graphql');
var { buildSchema } = require('graphql');
var resolver = require('graphql-mongodb-resolver')
var MongoClient = require('mongodb').MongoClient

var url = 'mongodb://localhost:27017/myproject';

var schema = buildSchema(`
  type Query {
    hello: String
  }
`);

MongoClient.connect(url, function(err, db) {
    var app = express();
    app.use('/graphql', graphqlHTTP({
      schema: schema,
      rootValue: resolver(schema, db),
      graphiql: true,
    }));
    app.listen(4000, () => console.log('Now browse to localhost:4000/graphql'));
  db.close();
});

No need for writing resolvers. User should only define GraphQL scheme.

Keywords

FAQs

Package last updated on 22 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc