Ready to translate REST to GraphQL?


Let's get you equipped.

Have you installed Node.js?

Before you install OASGraph, make sure to download and install Node.js (version 8.9.x or higher), a JavaScript runtime.


Install OASGraph

OASGraph can be used either as a library, or via its Command Line Interface (CLI) to quickly get started. To install the OASGraph CLI, simply run the indicated command.

$ npm i -g oasgraph-cli
            

Save OAS

OASGraph relies on the OpenAPI Specification (OAS) of an existing API to create a GraphQL interface around that API.

If you use LoopBack, start your API server in the LoopBack project folder, and access the API's OAS at http://127.0.0.1:3000/openapi.json. Save the OAS to disk.

# in the LoopBack project folder:
$ npm start
            

If you want to generate a GraphQL interface for another API, make sure that API is running and save its OAS.


Start GraphQL server

Once OASGraph is installed and the OAS is obtained, you can create and start the GraphQL server from the folder in which OASGraph is installed. The created GraphQL server is then accessible at http://127.0.0.1:3001/graphql.

# in the OASGraph folder:
$ oasgraph [path to saved OAS]