Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/urbit/js-http-api
A JS library for interfacing with Urbit over HTTP
https://github.com/urbit/js-http-api
http javascript urbit
Last synced: 3 months ago
JSON representation
A JS library for interfacing with Urbit over HTTP
- Host: GitHub
- URL: https://github.com/urbit/js-http-api
- Owner: urbit
- Created: 2023-01-20T21:51:05.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-14T15:39:36.000Z (8 months ago)
- Last Synced: 2024-03-15T04:47:17.694Z (8 months ago)
- Topics: http, javascript, urbit
- Language: TypeScript
- Homepage: https://developers.urbit.org/guides/additional/http-api-guide
- Size: 351 KB
- Stars: 11
- Watchers: 6
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-urbit - JavaScript HTTP API
README
# Urbit JS HTTP API
This project allows you to connect to an [Urbit](https://urbit.org) ship via a JavaScript application. In-depth usage can be found in [the guide](https://developers.urbit.org/guides/additional/http-api-guide).
## 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`.