@huolala-tech/nad-builder
v1.1.3
Published
Convert the Java AST to client-side code
Downloads
197
Keywords
Readme
nad-builder ·
Convert the Java AST to client-side code.
Include
yarn add @huolala-tech/nad-builder
or
npm install @huolala-tech/nad-builder --save
Demo
import { Builder } from '@huolala-tech/nad-builder';
// You don't need to write this manually, as it can be obtained from the Java service.
const defs = {
routes: [
{
name: 'foo',
bean: 'test.Demo',
methods: ['POST'],
patterns: ['/foo'],
parameters: [{ name: 'id', type: 'java.lang.Long' }],
returnType: 'java.lang.Long',
},
],
};
const base = 'http://localhost';
const target = 'ts';
const { code } = new Builder({ defs, target, base });
console.log(code); // Output the generated TypeScript code