I'm new to Loopback4 and trying to call REST endpoint using lb4 datasource and have some questions:
- Does
lb4 datasource
andlb4 service
bound to datasource generates proxy methods to call REST endpoints based on OpenAPI definition? - If #1 is yes, what is the correct way to do it?
I tried what is in this guide:
- Create a LoopBack 4 DataSource with OpenAPI connector using the lb4 datasource command.
- Create a service that maps to the operations using the lb4 service command.
But it doesn't generate any method in service nor datasource.
PS: I'm using Swagger Petstore definition to do this sample. What am I missing?
Ok, found the right tool to do it:
lb4 openapi --client
Stubs will be generated.
To call the service, just inject it in Controller and execute generated methods.