gerard2p/koaton

View on GitHub
src/middleware/subdomainrouter.js

Summary

Maintainability
A
1 hr
Test Coverage

Showing 1 of 1 total issue

Function subdomainrouter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default async function subdomainrouter (ctx, next) {
ctx.subdomain = 'www';
for (const subdomain of configuration.server.subdomains) {
if (ctx.request.host.indexOf(subdomain) === 0) {
ctx.state.subdomain = subdomain;
Severity: Minor
Found in src/middleware/subdomainrouter.js - About 1 hr to fix
Category
Status