25.0.0-beta.3 • Published 6 months ago
@contextjs/webserver-middleware-static v25.0.0-beta.3
@contextjs/webserver-middleware-static
Static files middleware for the ContextJS webserver.
Installation
npm i @contextjs/webserver-middleware-staticUsage
import "@contextjs/webserver-middleware-static";
import { Application } from "@contextjs/system";
import { WebServerOptions } from "@contextjs/webserver";
import { StaticFilesOptions } from "@contextjs/webserver-middleware-static";
const application = new Application();
application.useWebServer((options: WebServerOptions) => {
options.onEvent = e => console.log(`[WebServer:${e.type}]`, e.detail);
options.useStaticFiles((staticFilesOptions: StaticFilesOptions) => {
staticFilesOptions.publicFolder = "your-static-files_folder";
staticFilesOptions.fileExtensions = ["png", "jpg", "jpeg", "gif"]; // Only allow these file types
// staticFilesOptions.fileExtensions = []; // Uncomment to allow all file types
});
});
await application.runAsync();API Reference
For detailed API documentation, please refer to the API Reference.
25.0.0-beta.3
6 months ago
25.0.0-beta.2
6 months ago
25.0.0-beta.1
6 months ago
0.5.3-alpha.1
6 months ago
0.5.2-alpha.1
6 months ago
0.5.1-alpha.1
6 months ago
0.5.0-alpha.1
7 months ago
0.4.8
7 months ago
0.4.7
7 months ago
0.4.6
8 months ago
0.4.5
8 months ago
0.4.4
8 months ago
0.4.3
8 months ago