mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
chore(nginx): The routes /, /robots.txt, /favicon.ico were moved to nginx for the web microservice. Added html page to the home route
This commit is contained in:
parent
907b614f25
commit
6bae4dabfc
14 changed files with 1480 additions and 28 deletions
38
web/main.js
Normal file
38
web/main.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const logger = require("../shared/logger");
|
||||
const config = require("../shared/config/src/main.js")();
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("node:path");
|
||||
|
||||
const fastify = require("fastify")({
|
||||
logger: config["server"]["log"]["print"] ? logger : false,
|
||||
...(config["server"]["ssl"]["work"]
|
||||
? {
|
||||
https: {
|
||||
key: fs.readFileSync(config["server"]["ssl"]["private_key"], "utf8"),
|
||||
cert: fs.readFileSync(config["server"]["ssl"]["cert"], "utf8"),
|
||||
},
|
||||
}
|
||||
: false),
|
||||
});
|
||||
|
||||
fastify.register(require('@fastify/static'), {
|
||||
root: path.join(__dirname, 'src/static'),
|
||||
prefix: '/static/',
|
||||
});
|
||||
|
||||
fastify.register(require('./routes/home.js'));
|
||||
|
||||
|
||||
fastify.listen(
|
||||
{
|
||||
port: 3050,
|
||||
host: config["server"]["host"] ? config["server"]["host"] : "localhost",
|
||||
},
|
||||
(err) => {
|
||||
if (err) {
|
||||
fastify.log.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
},
|
||||
);
|
Loading…
Add table
Reference in a new issue