黑名单功能

This commit is contained in:
masnn committed 2020-06-10 12:20:07 +08:00
1 parent 55912b087d
commit 160b4482cc
11 files changed
+282 -158

No files matched your search

+9 -3
View File
@@ -1,6 +1,7 @@
const assert = require('assert');
const path = require('path');
const os = require('os');
const cluster = require('cluster');
const { ObjectID } = require('bson');
const Koa = require('koa');
const yaml = require('js-yaml');
@@ -438,12 +439,17 @@ function Validate(key, func) {
else validate[key] = [func];
}
async function start(port) {
async function start() {
app.use(morgan(':method :url :status :res[content-length] - :response-time ms'));
app.use(router.routes()).use(router.allowedMethods());
Route('*', Handler);
server.listen(port);
if (port) console.log('Server listening at: %s', port);
if (cluster.worker.id === 1) {
const port = await system.get('server.port');
server.listen(port);
console.log('Server listening at: %s', port);
} else {
server.listen();
}
}
global.Hydro.service.server = module.exports = {