Support registering namespaced view directories; add lib() universal path
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-06-24 00:14:04 -05:00
parent a69c81ed35
commit 7506d6567d
9 changed files with 201 additions and 17 deletions

View File

@@ -5,6 +5,8 @@ import {Logging} from './Logging'
import {Route} from '../http/routing/Route'
import {HTTPMethod} from '../http/lifecycle/Request'
import {ViewEngineFactory} from '../views/ViewEngineFactory'
import {ViewEngine} from '../views/ViewEngine'
import {lib} from '../lib'
/**
* Application unit that loads the various route files from `app/http/routes` and pre-compiles the route handlers.
@@ -18,6 +20,9 @@ export class Routing extends Unit {
public async up(): Promise<void> {
this.app().registerFactory(new ViewEngineFactory())
const engine = <ViewEngine> this.make(ViewEngine)
this.logging.verbose('Registering @extollo view engine namespace.')
engine.registerNamespace('extollo', lib().concat('resources', 'views'))
for await ( const entry of this.path.walk() ) {
if ( !entry.endsWith('.routes.js') ) {