21 lines
557 B
TypeScript
21 lines
557 B
TypeScript
import { Application } from 'express';
|
|
import Handler from './classes/Handler';
|
|
import Session from './classes/Session';
|
|
import Transaction from './classes/Transaction';
|
|
|
|
/**
|
|
* register an array of handlers to an express app
|
|
*
|
|
* @param {Application} app express app
|
|
* @param {Array<Handler>} handlers handlers to register
|
|
*/
|
|
export default function load_handlers (
|
|
app: Application,
|
|
handlers: Array<Handler>
|
|
): void {
|
|
for (const h of handlers)
|
|
app.use (h.path, h.run_http_handler);
|
|
}
|
|
|
|
export { Handler, Session, Transaction, load_handlers };
|