1.4.0 • Published 4 years ago

restaf-graphql-server v1.4.0

Weekly downloads
29
License
Apache-2.0
Repository
github
Last release
4 years ago

restaf-graphql-server

The restaf-graphql-server is designed to work with SAS Vya. It uses two key open source projects"

  1. Apollo's graphql-server

  2. hapijs

It also depends on restaf

The primary purposes of this library are: 1. Hooks in Viya 3.4 authentication - uses authorization_code

  1. Serve up user apps and/or graphql playground- convenient for deploying self-contained app

  2. Uses restaf to make REST calls to Viya Server

See CHANGELOG.md for current and future features.

Disclaimer

In this project we have chosen to use Apollo Server and hapijs - mainly due to the developer's familiarity with these open source software artificats.

Installing the server as a dependency

In your graphql based app npm install this server

npm install restaf-graphql-server
 

Running the server in your app

To start the server write a code as shown below in your app's entry point. This code passes the typeDefs and resolvers to setup the graphql server.

    // app.js
    let restafGraphqlServer     = require('restaf-graphql-server');
    let resolvers              = require('./test/resolvers'); // where your resolvers are 
    let typeDefs               = require('./test/schema/schema.graphql'); // where your typeDefs are
    let userRoutes             = null; 
    // set your userRoutes if you have any 
    restafGraphqlServer(typeDefs, resolvers, userRoutes);

The information to connect to SAS Viya and other application specific information should be specifed in the env file. Please see the test.env file in this repository for information.

Notes on userRoutes

Since this server uses hapijs the routes must conform to hapijs specs for routes. The following routes are reserved

  1. graphql - for graphql playground

  2. /{param*} - to serve up pages other than graphql

  3. /appenv - to receive selected environment variables in your app -set in the env.js file

1.4.1

4 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.7.4

5 years ago

0.7.2

5 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.1.0

5 years ago