shrub/pkg/npm/http-api
2022-05-05 00:33:37 +02:00
..
example http-api: update to working example 2021-11-09 12:26:40 -06:00
src @urbit/api: do not reconnect if there is a FatalError 2022-03-31 14:52:18 -06:00
test api,http-api: updating babel usage and fixing tests 2021-11-09 13:16:48 -06:00
tmp wip 2022-02-01 13:25:28 -06:00
.babelrc api,http-api: updating babel usage and fixing tests 2021-11-09 13:16:48 -06:00
.gitignore npm: removing intermediate ts files from pkg, fixing more bad references 2021-11-10 17:54:31 -06:00
jest.config.cjs api,http-api: updating babel usage and fixing tests 2021-11-09 13:16:48 -06:00
package-lock.json Merge branch 'next/groups' into hm/landscape-perf-optimization 2022-03-11 15:45:00 -06:00
package.json npm: changing to release version 2021-11-23 16:12:36 -06:00
README.md added NPM packages 2021-01-26 21:45:18 -08:00
rollup.config.ts http-api: updating build to use rollup for better distribution 2021-11-08 18:43:22 -06:00
setupEnv.js @urbit/http-api: setup testing 2021-07-12 12:07:19 +10:00
tsconfig.json npm: removing intermediate ts files from pkg, fixing more bad references 2021-11-10 17:54:31 -06:00

Urbit Connector

This project allows you to connect to an Urbit ship via a JavaScript application.

Example

Check out the example directory for examples of how to use this code.

  1. Open example/index.html in your browser and follow the instructions there, or
  2. With a ship running in the same fashion as indicated in the file above, run node example/index.js

The code for either of these can be found in src/example/browser.js or src/example/node.js, depending on your context.

Design

This library is designed to be useful for node applications that communicate with an urbit running either on the local computer or on a remote one.

The majority of its methods are asynchronous and return Promises. This is due to the non-blocking nature of JavaScript. If used in a React app, response handlers should be bound with this to setState after a message is received.

NOTE

You must enable CORS requests on your urbit for this library to work in browser context. Use +cors-registry to see domains which have made requests to your urbit, and then approve the needed one, e.g. |cors-approve http://zod.arvo.network.