However, we will first explore the open source LoopBack project, which is integrated with IBM API Connect. We previously mentioned Loopback as an alternative to GraphQL, because it does indeed provide a convention for API exposure that resolves the REST limitations noted above. However, Loopback is more than that. LoopBack is a Node.js based framework that provides a way to rapidly create a REST API implementation from a data source. We will use this in our example to create a sample REST API. We can then briefly explore how the LoopBack augmentations to REST enable GraphQL-like interaction. Finally, we will show how we can place a Wrapper around our Loopback-based REST API (or indeed any Open API Specification based API) to convert it into GraphQL. 

## 6.11.1 IBM, GraphQL, and Loopback 

IBM has a strong commitment to open source. We are an active member of the GraphQL community, and the original creator of the now open source “OpenAPI-to-GraphQL” project used at the end of this section. 

“ We are pleased to join the new GraphQL Foundation as a founding member to help drive greater open source innovation and adoption of this important data access language and runtime for APIs. ” – Juan Carlos Soto, VP Hybrid Cl oud Integration and API Economy, IBM. 

IBM is also the owner and primary contributor to the open source LoopBack framework used in this example to rapidly create API implementations. 

## 6.11.2 LoopBack models and relationships 

LoopBack is a highly extensible, open-source Node.js framework based on Express that enables you to quickly create APIs and microservices that are composed from back-end systems such as databases and SOAP or REST services. 

Individual models are easy to understand and work with. But in reality, models are often connected or related. When you build a real-world application with multiple models, you’ll typically need to define relations between models. For example: 

– A customer has many orders and each order is owned by a customer. 

– A user can be assigned to one or more roles and a role can have zero or more users. 

– A physician takes care of many patients through appointments. A patient can see many physicians too. 

With connected models, LoopBack exposes as a set of APIs to interact with each of the model instances and query and filter the information based on the client’s needs. 

You can define the following relationships (called relations in LoopBack) between models: 

– BelongsTo 

– HasOne 

– HasMany 

– HasManyThrough 

– HasAndBelongsToMany 

– Polymorphic 

– Embedded (embedsOne and embedsMany) 

