mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Global logging
This commit is contained in:
parent
857feda5fe
commit
ae46584359
6 changed files with 19 additions and 46 deletions
27
server.js
27
server.js
|
@ -21,6 +21,8 @@
|
|||
const express = require('express')
|
||||
const vhost = require('vhost')
|
||||
const logger = require('./utils/logger.js')
|
||||
const stat = require('./utils/stat.js')
|
||||
stat.Load()
|
||||
|
||||
const qmining = require('./modules/qmining.js').app
|
||||
const main = require('./modules/main.js').app
|
||||
|
@ -52,16 +54,23 @@ const port = 8080
|
|||
// }
|
||||
// }
|
||||
|
||||
express()
|
||||
.use(vhost('qmining.frylabs.net', qmining))
|
||||
.use(vhost('sio.frylabs.net', sio))
|
||||
.use(vhost('stuff.frylabs.net', stuff))
|
||||
.use(vhost('frylabs.net', main))
|
||||
.use(vhost('qmining.tk', qmining))
|
||||
.use(function (req, res, next) {
|
||||
console.log(req)
|
||||
const app = express()
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.on('finish', function () {
|
||||
logger.LogReq(req, true, res.statusCode)
|
||||
if (res.statusCode !== 404) { stat.LogStat(req.url) }
|
||||
})
|
||||
.listen(port)
|
||||
next()
|
||||
})
|
||||
|
||||
app.use(vhost('qmining.frylabs.net', qmining))
|
||||
app.use(vhost('sio.frylabs.net', sio))
|
||||
app.use(vhost('stuff.frylabs.net', stuff))
|
||||
app.use(vhost('frylabs.net', main))
|
||||
app.use(vhost('qmining.tk', qmining))
|
||||
|
||||
app.listen(port)
|
||||
|
||||
logger.Log('Node version: ' + process.version)
|
||||
logger.Log('Listening on port: ' + port)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue