RethinkDB / Horizon: Integration with Express: Access Horizon data server-side?

前端 未结 2 1763
野的像风
野的像风 2021-01-13 18:58

There is an example of express integration on the Horizon.io Github as shown here: Horizon express server example

I understand what this example is showing: if you h

2条回答
  •  猫巷女王i
    2021-01-13 19:26

    To access the collections of Horizon you can use the @horizon/client.

    npm install --save  @horizon/client
    

    in server side code:

    const Horizon = require("@horizon/client/dist/horizon");
    const horizon = Horizon();
    

    And then you can use the Horizon API:http://horizon.io/api/horizon/ for things such as connection, Auth, and users; then use the collection API: http://horizon.io/api/collection/ for getting access to the same collections that the client accesses.

提交回复
热议问题