"vue 使用js-hal hal json"

Published on Aug. 22, 2023, 12:03 p.m.

In Node.JS

npm install hal
var hal = require('hal');  

var resource = new hal.Resource({name: "Harry"}, '/harry');  
resource.link('hello', '/harry/hello');  
console.log(resource.toJSON());
vue中
import hal from 'hal';

var resource = new hal.Resource({name: “Harry”}, ‘/harry’);
resource.link(‘hello’, ‘/harry/hello’);
console.log(resource.toJSON());


更多查看项目地址 https://github.com/byteclubfr/js-hal 


Tags: