-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.ts
More file actions
25 lines (22 loc) · 873 Bytes
/
boot.ts
File metadata and controls
25 lines (22 loc) · 873 Bytes
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
import { registerBulk } from '@bitbeat/core';
import { WebServer, WebServerConfig, Documentation } from '@bitbeat/web';
import fastifyStatic from 'fastify-static';
import { join } from 'path';
export default async (): Promise<void> => {
const webConfig = new WebServerConfig();
const webServer = new WebServer();
(webConfig.default as any).fastifyHelmet = {
contentSecurityPolicy: false,
};
webConfig.default.port = 3000;
(webConfig.default as any).static = {
root: join(__dirname, 'public'),
};
(webServer as any).postRegister.add(
(runtime: any, config: WebServerConfig | undefined): void => {
runtime.register(fastifyStatic, config?.value.static);
webServer.debug(`Registered fastify static.`);
}
);
await registerBulk(new Set([webConfig, webServer, Documentation]));
};