-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (25 loc) · 812 Bytes
/
server.js
File metadata and controls
31 lines (25 loc) · 812 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
'use strict';
const initDecorators = require('./decorators/index.js');
const loadApplication = require('./lib/loader');
const initPlugins = require('./plugins/index.js');
const ws = require('./lib/ws');
const http = require('./lib/http');
const dotenv = require('dotenv');
const fastify = require('fastify')({ logger: true });
dotenv.config();
(async () => {
const { api, config } = await loadApplication();
initDecorators(fastify, config);
initPlugins(fastify);
ws.init(fastify, api);
http.init(fastify, api);
// Run the server!
fastify.log.info({ api });
await fastify.listen({
port: config.environment.port,
host: config.environment.host,
});
fastify.log.info(`API on port ${config.environment.port}`);
// TODO
// - now static runs without prefix -> /static prefix
})();