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

孤者浪人 提交于 2019-12-01 06:32:16

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.

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/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!