Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@acastellon/graphql

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acastellon/graphql

GraphQL (throw HTTPS) based in Express

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Graphql

Module to encapsulate the common configuration of a base WS based in GraphQL (HTTPS/Express)


Example Code to use this module:

const SERVER = require('./config.server.js');
const AUTH = require('./config.auth.js');

const graphql = require('@acastellon/graphql')(SERVER, AUTH);
graphql.run(); 

you can pass a function to be executed after the initialization of the server

rest.run(callback())

rest.run(() => { .. })

Example of configuration files required:

- config.server.js
module.exports = {
    /* where are stored the certificate files */
    CERTIFICATION_PATH : '/opt/<project>/Certificate'
    
    /* listener port */ 
    ,PORT : 7000
    
    /* file used by CORS to allows requst to the server */
    ,WHITELIST : './whitelist'

    /* location of the static files if is needed */
    ,STATIC_PATH : '/html'         //null = no static files where associated
    
    /* location of the Schema & resolvers required by graphql */
    ,SCHEMA_PATH : './graphql/schema/'
}
- config.auth.js
module.exports = {
    url: 'ldap://<address>:389'
    ,DOMAIN: '<domain>'
    ,baseDN: 'DC=<>,DC=<>>'
    ,username: '<username>'
    ,password: '<password>'

    ,hostNames: {
        'DEV' : '<dev-server.ip.dns.name>'
        ,'QA' : '<QA-server.ip.dns.name>'
        ,'PROD' : '<production-server.ip.dns.name>'
    }
    ,passToken: '<passphrase-optional>'  /* if doesn't exists the module generates ones automatically */
    ,EXPIRES: 86400                     /* expires in 24 hours */

    , AUTH_TYPE : 'NTLM'  /* NTLM, JWT or NONE */

    ,MOCKUP_USERS : ['acastellon']
    ,MOCKUP_ROLES : ['User','Admin']
    ,ROLES : {                          /* LDAP Roles to match */
        'User': '<LDAP> USER '          
        , 'Admin': '<LDAP> ADMINISTRATOR '
        , 'Viewer': '<LDAP> VIEWER '
    }
}

- api.js
- See the api.template.js as a reference to implement the logic.



Security files required:

- privateKey.pem
- publicCert.pem
- passphrase

Other files required:

- whitelist : used by CORS

Keywords

FAQs

Package last updated on 27 Nov 2019

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