-
Notifications
You must be signed in to change notification settings - Fork 39
/
ApiV2.ts
39 lines (35 loc) · 1.18 KB
/
ApiV2.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Application } from 'express';
import Logger from '../../Logger';
import CountryCodes from '../../service/CountryCodes';
import Service from '../../service/Service';
import Controller from '../Controller';
import { apiPrefix } from './Consts';
import ChainRouter from './routers/ChainRouter';
import InfoRouter from './routers/InfoRouter';
import NodesRouter from './routers/NodesRouter';
import ReferralRouter from './routers/ReferralRouter';
import RouterBase from './routers/RouterBase';
import SwapRouter from './routers/SwapRouter';
class ApiV2 {
private readonly routers: RouterBase[];
constructor(
private readonly logger: Logger,
service: Service,
controller: Controller,
countryCodes: CountryCodes,
) {
this.routers = [
new InfoRouter(this.logger, service),
new SwapRouter(this.logger, service, controller, countryCodes),
new ChainRouter(this.logger, service),
new NodesRouter(this.logger, service),
new ReferralRouter(this.logger),
];
}
public registerRoutes = (app: Application) => {
this.routers.forEach((router) =>
app.use(`${apiPrefix}/${router.path}`, router.getRouter()),
);
};
}
export default ApiV2;