This repository has been archived on 2020-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
requestor/lib/index.ts

21 lines
557 B
TypeScript
Raw Normal View History

2020-04-09 11:11:19 +02:00
import { Application } from 'express';
2020-04-09 09:14:54 +02:00
import Handler from './classes/Handler';
2020-04-09 21:12:36 +02:00
import Session from './classes/Session';
import Transaction from './classes/Transaction';
2020-04-08 20:46:48 +02:00
/**
* register an array of handlers to an express app
*
2020-04-09 11:11:19 +02:00
* @param {Application} app express app
2020-04-08 20:46:48 +02:00
* @param {Array<Handler>} handlers handlers to register
*/
export default function load_handlers (
2020-04-09 11:11:19 +02:00
app: Application,
2020-04-09 10:31:15 +02:00
handlers: Array<Handler>
2020-04-08 20:46:48 +02:00
): void {
for (const h of handlers)
app.use (h.path, h.run_http_handler);
}
2020-04-09 21:12:36 +02:00
export { Handler, Session, Transaction, load_handlers };