0.0.18 • Published 2 days ago

kitsas-addon-library v0.0.18

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

Kitsas Addon Library

Library for Kitsas Addons. See also Template for Kitsas Addons and Kitsas Library

Documentation on GitHub Pages

Installation

npm install --save kitsas-addon-library

Creating an addon

Create an addon instance

import { KitsasAddon } from 'kitsas-addon-library';
const addon = new KitsasAddon({
  appName: 'My Addon',
});

export default addon;

Options can be configured with AddonOptions or environment variables.

Create routers

import addon from './addon';
import { AddonCall } from 'kitsas-addon-library';
import { Request, Response } from 'express';
const router = addon.createRouter('/addon');

router.get('/', async (req: Request, res: Response) => {
  const call = new AddonCall(req);
  const logs = await call.getLogs();

  if (call.isActive()) {
    res.render('main', { logs: logs });
  } else {
    res.render('introduction');
  }
});

export default router;

Usually router handles get an AddonCall object containing information about the call and methods to interact with the Kitsas Server.

Create index.ts

import addon from './addon';

import addonRouter from './addonRouter';

void addon.start([addonRouter]);

Remember to include all the routers in the start call!

0.0.18

2 days ago

0.0.17

6 days ago

0.0.16

12 days ago

0.0.13

13 days ago

0.0.14

13 days ago

0.0.15

13 days ago

0.0.12

21 days ago

0.0.11

21 days ago

0.0.10

1 month ago

0.0.9

1 month ago

0.0.8

1 month ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.5

2 months ago

0.0.3

2 months ago

0.0.4

2 months ago

0.0.2

2 months ago

0.0.1

2 months ago