deno.land / x / alosaur@v1.1.1 / examples / microservice / mservice / home.area.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { ActionParam, Area, Body, Controller } from "alosaur/mod.ts";import { MEvent, MPattern } from "alosaur/microservice/mod.ts";
@Controller()export class HomeController { @MPattern({ cmd: "sum" }) @ActionParam(0, Body()) async sum(body: number[]) { return Array.isArray(body) ? body.reduce((acc, cur) => acc + cur, 0) : 0; }
@MEvent("calculated") @ActionParam(0, Body()) async event(body: string) { return body; }}
@Area({ controllers: [HomeController],})export class HomeArea {}
alosaur

Version Info

Tagged at
a year ago