This package has been deprecated

Author message:

old

abox
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

abox - Api Toolbox

Build Status npm version codecov.io

Quickstart

Installation

npm install abox --save

Code Example

action.ts

import {Action} from "abox";

@Action({ name: "ping" })
export class Ping {
  constructor(public message: string) {

  }
}

@Action({ name: "pong" })
export class Pong {
  constructor(public message: string) {

  }
}

app.ts

import {Api} from "abox";
import {Ping, Pong} from "./actions";

const api = new Api();

api
  .on(Ping)
  .handle((context, data) => {
    context.done(new Pong(data.message));
  });

api
  .on(Pong)
  .handle((context, data) => {
    console.log("Pong:", data.message);
    context.done();
  });

export = api;

Readme

Keywords

Package Sidebar

Install

npm i abox

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • no0dles