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

前端 未结 2 1741
野的像风
野的像风 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条回答
  • 2021-01-13 19:06

    You need to create express/koa/hapi server, where you include horizon/server and provide your own implementation for custom API endpoints.

    Read more here: http://horizon.io/docs/embed/

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题