Skip to content

staabm/hal-browser

 
 

Repository files navigation

HAL browser

This package provides a middleware for HAL APIs.

The middleware looks for HAL and JSON responses, and automatically converts them into a HTML interface if a browser access them.

It does so via the Accept: text/html header. If this header is not provides, the middleware does nothing.

Supported frameworks

Installation

npm install hal-browser

Getting started

Curveball

import { Application } from 'curveball/@core';
import halBrowser from 'hal-browser';

const app = new Application();
app.use(halBrowser({
  title: 'HAL Browser',
  stylesheets: [
    // path to CSS stylesheets
  ],
});

The HAL browser ships with 2 really basic stylesheets in the styles directory:

  • main.css - Main interface css
  • solarized-dark.css - A syntax highlighting stylesheet lifted from the Highlight.js project, and originally created by (c) Jeremy Hull

For best effect you'll want both stylesheets!

Express

TODO

Koa

TODO

API

About

A HAL browser middleware for node.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • TypeScript 66.1%
  • CSS 30.0%
  • Makefile 3.9%