Корневой файл сервера
This commit is contained in:
@@ -1,10 +1,23 @@
|
|||||||
var express = require('express');
|
const express = require('express');
|
||||||
var app = express();
|
const app = express();
|
||||||
|
|
||||||
app.get('/', function(req, res) {
|
const config = require('./config/config');
|
||||||
res.send('hello world');
|
const logger = require('./core/loggerInit')(config);
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(3000, "0.0.0.0", function() {
|
const SqliteConnectionPool = require('./core/SqliteConnectionPool');
|
||||||
console.log("server started");
|
|
||||||
|
async function main() {
|
||||||
|
const connPool = new SqliteConnectionPool(20, logger, config);
|
||||||
|
await connPool.init();
|
||||||
|
|
||||||
|
app.use(app.json());
|
||||||
|
app.static('public');
|
||||||
|
|
||||||
|
require('./routes')(app, connPool, logger, config);
|
||||||
|
|
||||||
|
app.listen(config.port, config.ip, function() {
|
||||||
|
logger.log('Server is ready');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
Reference in New Issue
Block a user