enhancement(extollo/extollo#2): add kernel module for parsing request body contents, uploading files
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -89,6 +89,23 @@ export class Files extends Unit {
|
||||
}
|
||||
|
||||
await Promise.all(promises)
|
||||
|
||||
// Once they have initialized, register the DI token for the default filesystem
|
||||
this.app().registerProducer(Filesystem, () => {
|
||||
// This will throw FilesystemDoesNotExistError if no default filesystem was created
|
||||
// Such behavior is desired as it is clearer than an invalid injection error, e.g.
|
||||
return this.getFilesystem()
|
||||
})
|
||||
|
||||
// If file uploads are enabled, ensure that the default upload prefix exists
|
||||
if ( this.defaultFilesystem ) {
|
||||
const upload = this.config.get('server.uploads', {})
|
||||
if ( upload?.enable && upload?.filesystemPrefix ) {
|
||||
await this.defaultFilesystem.mkdir({
|
||||
storePath: upload.filesystemPrefix,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async down() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import {ExecuteResolvedRouteHandlerHTTPModule} from "../http/kernel/module/Execu
|
||||
import {error} from "../http/response/ErrorResponseFactory";
|
||||
import {ExecuteResolvedRoutePreflightHTTPModule} from "../http/kernel/module/ExecuteResolvedRoutePreflightHTTPModule";
|
||||
import {ExecuteResolvedRoutePostflightHTTPModule} from "../http/kernel/module/ExecuteResolvedRoutePostflightHTTPModule";
|
||||
import {ParseIncomingBodyHTTPModule} from "../http/kernel/module/ParseIncomingBodyHTTPModule";
|
||||
|
||||
/**
|
||||
* Application unit that starts the HTTP/S server, creates Request and Response objects
|
||||
@@ -42,6 +43,7 @@ export class HTTPServer extends Unit {
|
||||
ExecuteResolvedRouteHandlerHTTPModule.register(this.kernel)
|
||||
ExecuteResolvedRoutePreflightHTTPModule.register(this.kernel)
|
||||
ExecuteResolvedRoutePostflightHTTPModule.register(this.kernel)
|
||||
ParseIncomingBodyHTTPModule.register(this.kernel)
|
||||
|
||||
await new Promise<void>((res, rej) => {
|
||||
this.server = createServer(this.handler)
|
||||
|
||||
Reference in New Issue
Block a user