Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-06-02 22:36:25 -05:00
parent 82e7a1f299
commit 1d5056b753
149 changed files with 6104 additions and 3114 deletions

View File

@@ -1,7 +1,7 @@
import {Container} from "../../di";
import {ResponseFactory} from "./ResponseFactory";
import {Request} from "../lifecycle/Request";
import {ViewEngine} from "../../views/ViewEngine";
import {Container} from '../../di'
import {ResponseFactory} from './ResponseFactory'
import {Request} from '../lifecycle/Request'
import {ViewEngine} from '../../views/ViewEngine'
/**
* Helper function that creates a new ViewResponseFactory to render the given view
@@ -22,10 +22,12 @@ export class ViewResponseFactory extends ResponseFactory {
/** The name of the view to render. */
public readonly viewName: string,
/** Optional data that should be passed to the view engine as params. */
public readonly data?: {[key: string]: any}
) { super() }
public readonly data?: {[key: string]: any},
) {
super()
}
public async write(request: Request) {
public async write(request: Request): Promise<Request> {
const viewEngine = <ViewEngine> Container.getContainer().make(ViewEngine)
request.response.body = await viewEngine.renderByName(this.viewName, this.data || {})
request.response.setHeader('Content-Type', 'text/html; charset=utf-8')