25 lines
628 B
JavaScript
25 lines
628 B
JavaScript
const express = require('express');
|
|
const config = require('./config-handler');
|
|
|
|
const app = express();
|
|
|
|
app.use("/api", async (rq, rs, next) => next(), require('./api'));
|
|
|
|
app.get('/admin', async (req, res) => res.send('ok'));
|
|
|
|
app.use(!config().logger_mode ? async (rq, rs, next) => next() : require('./logger'), require('./api'));
|
|
|
|
// Подключение через HTTPS
|
|
let server;
|
|
if (!config().ssl.enabled) {
|
|
server = app;
|
|
}
|
|
|
|
server.listen(config().port, config().address, async (err) => {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
else {
|
|
console.log(`Kodex Muzic catalog runned at ${config().address}:${config().port}`);
|
|
}
|
|
}); |