Add better debugging to routing service

master
Garrett Mills 2 years ago
parent 1399399af9
commit 90b16eef53

@ -11,6 +11,7 @@ import {Config} from './Config'
import {PackageDiscovered} from '../support/PackageDiscovered' import {PackageDiscovered} from '../support/PackageDiscovered'
import {staticServer} from '../http/servers/static' import {staticServer} from '../http/servers/static'
import {Bus} from '../support/bus' import {Bus} from '../support/bus'
import {RequestLocalStorage} from '../http/RequestLocalStorage'
/** /**
* Application unit that loads the various route files from `app/http/routes` and pre-compiles the route handlers. * Application unit that loads the various route files from `app/http/routes` and pre-compiles the route handlers.
@ -26,6 +27,9 @@ export class Routing extends Unit {
@Inject() @Inject()
protected readonly bus!: Bus protected readonly bus!: Bus
@Inject()
protected readonly request!: RequestLocalStorage
protected compiledRoutes: Collection<Route<unknown, unknown[]>> = new Collection<Route<unknown, unknown[]>>() protected compiledRoutes: Collection<Route<unknown, unknown[]>> = new Collection<Route<unknown, unknown[]>>()
public async up(): Promise<void> { public async up(): Promise<void> {
@ -164,6 +168,11 @@ export class Routing extends Unit {
} }
public getAppUrl(): UniversalPath { public getAppUrl(): UniversalPath {
if ( this.request.has() ) {
const request = this.request.get()
this.logging.debug(`url: ${request.url} | fullUrl: ${request.fullUrl}`)
}
const rawHost = String(this.config.get('server.url', 'http://localhost')).toLowerCase() const rawHost = String(this.config.get('server.url', 'http://localhost')).toLowerCase()
const isSSL = rawHost.startsWith('https://') const isSSL = rawHost.startsWith('https://')
const port = this.config.get('server.port', 8000) const port = this.config.get('server.port', 8000)

Loading…
Cancel
Save