Skip to content


Zova provides a module home-api, which provides a basic API code skeleton based on axios. Custom API logic can be added on this basis, or even the axios underlying library can be directly replaced


  • Zova injects the $api object into the BeanBase base class, so that the axios instance can be obtained through this.$api in any bean instance
  • Zova also injects the $api object in app.meta, so that the axios instance can be accessed outside the bean instance

For example, load menu data:


export default (app: ZovaApplication) => {
  return {
    select: () => app.meta.$api.get<any, ServiceMenuEntity[]>('/home/layout/menu/select'),


The module home-api provides an home-api.bean.api bean, in which custom logic can be added directly


export class BeanApi {
  private [SymbolApi]: AxiosInstance;

  protected async __init__() {
    const baseURL = `${ || ''}${ || ''}/`;
    this[SymbolApi] = markRaw(axios.create({ baseURL }));
    // your custom logic maybe here

  protected __get__(prop) {
    return this[SymbolApi] && this[SymbolApi][prop];

Released under the MIT License.