Рефакторинг
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
const config = require('./config/config');
|
||||
const {initLogger, getLog} = require('./core/getLogger');
|
||||
initLogger(config);
|
||||
const log = getLog();
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
const config = require('./config/config');
|
||||
const logger = require('./core/loggerInit')(config);
|
||||
|
||||
const SqliteConnectionPool = require('./core/SqliteConnectionPool');
|
||||
|
||||
async function main() {
|
||||
const connPool = new SqliteConnectionPool(20, config);
|
||||
|
||||
logger.log('Opening database');
|
||||
log('Opening database');
|
||||
await connPool.init();
|
||||
|
||||
app.use(express.static('public'));
|
||||
app.use(express.json());
|
||||
|
||||
require('./routes')(app, connPool, logger, config);
|
||||
require('./routes').initRoutes(app, connPool, config);
|
||||
|
||||
app.listen(config.port, config.ip, function() {
|
||||
logger.log('Server is ready');
|
||||
log('Server is ready');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user