Search code examples
typescriptloopbackloopback4

how to use storage components in loopback 4.0?


i am using storage components in loopback 3.0 to accessing the cloud storage's. but i need how do implement in loopback 4.0.The below link to make it sample in 3.0.

https://github.com/strongloop/loopback-example-storage


Solution

  • Hello from the LoopBack team!

    We haven't looked into integration of loopback-component-storage with LoopBack version 4.

    Since the storage component behaves more like a connector than a component, I think it should be possible to use it in LoopBack 4 via @loopback/service-proxy layer. See Calling other APIS and web services for documentation. The code snippets on that page are using loopback-connector-rest as an example, you will use loopback-component-storage instead.

    Once you can access the the storage component from JavaScript/TypeScript, you will also need to expose REST API. LoopBack 4 does not provide any built-in controllers, you will have to write one yourself. Please see the definition of LB3 remote methods in storage-service.js, you will need to build controller methods to accept the same arguments and then call out to the service proxy under the hood.

    If you are willing to look into this integration, then it's probably best to open a new GitHub issue in loopback-next where we can have a structured conversation.