25.0.0-beta.3 • Published 5 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-static
Usage
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
5 months ago
25.0.0-beta.2
5 months ago
25.0.0-beta.1
5 months ago
0.5.3-alpha.1
5 months ago
0.5.2-alpha.1
5 months ago
0.5.1-alpha.1
5 months ago
0.5.0-alpha.1
6 months ago
0.4.8
6 months ago
0.4.7
6 months ago
0.4.6
7 months ago
0.4.5
7 months ago
0.4.4
7 months ago
0.4.3
7 months ago