File Upload With Loopback

前端 未结 4 1045
余生分开走
余生分开走 2021-01-01 06:31

I created a simple file uploading application with loopbackjs. In the application\'s client side I used simple HTML and Javascript code, calling a loopback api with an AJAX

4条回答
  •  孤独总比滥情好
    2021-01-01 06:55

    You can upload files/Images using loopback's default storage component. Go to the doc link and follow the instruction and specially look how the example project implemented the file uploading.

    You will have to create a datasource and a container model for this purpose.

    Create Datasource:

    $ lb datasource
    [?] Enter the data-source name: myfilesystem
    [?] Select the connector for myfilesystem: other
    [?] Enter the connector name: loopback-component-storage
    [?] Install storage (Y/n)
    

    create the container model:

    • Model name: Container
    • Data source: myfilesystem
    • Base class: Model
    • Expose Reviewer via the REST API? Yes
    • Custom plural form (used to build REST URL): Yes

提交回复
热议问题