0.0.10 • Published 1 year ago

apika v0.0.10

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

Apika

Just.. don't

Backend

Setup with Fastify.

import {ApikaServ} from 'apika/serv';

export const apiControllers = {
  client_product_loadAll: loadAllController,
  ...
} as const;

export type ApiControllers = typeof apiControllers;

export const apikaServ = new ApikaServ(apiControllers);
Core.app.post('/api/:controller', async _req => {
  return await apikaServ.handle({
    controller: (_req.params as any).controller,
    body: _req.body,
    ctx: {
      headers: _req.headers,
    },
  });
});

Frontend

It is important to import exactly types, not the whole backend code: import type ....

import type {ApiControllers} from '@@api';
import {Injectable} from '@angular/core';
import {Apika} from 'apika';

@Injectable({
  providedIn: 'root',
})
export class Api extends Apika<ApiControllers> {
  url = '/api/';
}

Apika uses HttpClient, you have to setup it properly:

TODO

Req

Render template if status is Succeed:

<div *req="loadAllReq.status">
  ...
</div>

You can provide custom views for Ongoing and Failed statuses:

{
  provide: ApikaReqOngoing,
  useValue: LoadingSpinnerComponent,
},
{
  provide: ApikaReqFailed,
  useValue: LoadingErrorComponent,
}

TODO

  • prettier
  • README
    • ReqOutlet demo
    • tsconfig paths demo
    • Controller demo
    • Auth demo
    • zod demo
    • Prisma demo
    • err
  • tests
0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago