-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
35 lines (27 loc) · 798 Bytes
/
main.ts
File metadata and controls
35 lines (27 loc) · 798 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
26
27
28
29
30
31
32
33
34
35
import { connectClient } from './config/db';
import Fastify from 'fastify';
import qs from 'qs';
import * as dotenv from 'dotenv';
// import dbClient from './config/db';
import { ajvOptions } from './src/AjvOptions';
dotenv.config();
async function main() {
await connectClient(); // Connect to the database here
const fastify = Fastify({
logger: true,
querystringParser: (str) => qs.parse(str, { allowDots: true }),
pluginTimeout: 60000,
ajv: ajvOptions,
});
const port = Number(process.env.APP_PORT);
const appUrl = process.env.APP_URL ?? 'https://aws.raapbuilders.com';
await fastify.register(import('./src/app'), {
url: appUrl,
appVersion: process.env.VERSION ?? '0.0.0',
});
await fastify.listen({
port,
host: '0.0.0.0',
});
}
main();