0.0.0-68c4e27 • Published 1 year ago

@dxc-technology/halstack-browser v0.0.0-68c4e27

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Halstack Browser

Halstack Browser is a React component that can be included in any React Web App and provides a visual mechanism to crawl and discover API resources and operations dynamically for hypermedia-based APIs. In contrary to other path-based approaches such as OpenAPI (where static specs are used to describe a list of pre-defined path resources and available operations) Halstack Browser allows both API consumers and producers work with auto-discoverable REST APIs just based on their implementations, without any spec. Thus, every time an API implementation changes, these updates will be automatically visible in Halstack Browser Web component without the need of importing or configuring any API spec.

Halstack Browser in Action

See this demo app using Halstack browser. Paste your hypermedia-based API endpoint and start browsing!

Use

Installation

npm install @dxc-technology/halstack-browser --save

Implementation example

// import the HalUI component
import HalUI from "@dxc-technology/halstack-browser";

// use the component in your app
<HalUI url={api_base_url} headers={headers_object} />

Properties

NameTypeDefaultDescription
urlStringNoneRequired. This property contains the base URL of your HAL API.
headersJSON ObjectNoneContains an object with the headers to be sent to every request to the API.

Develop

In the first place, clone this repository.

git clone https://github.com/dxc-technology/halstack-browser.git

Local development is broken into two parts, related to the lib/example folders.

First, within the lib folder, run rollup to watch your src/ module and automatically recompile it into dist/ whenever you make changes.

cd lib
npm install
npm start # runs rollup with watch flag

The second part will be running the example/ create-react-app that's linked to the local version of your module.

# (in another tab)
cd example
npm install
npm start # runs create-react-app dev server

Now, anytime you make a change to your library in src/ or to the example app's example/src, create-react-app will live-reload your local dev server so you can iterate on your component in real-time.

License

See Halstack Browser License here