aim_server_static 0.0.1 copy "aim_server_static: ^0.0.1" to clipboard
aim_server_static: ^0.0.1 copied to clipboard

Static file serving middleware for the Aim framework with security built-in.

0.0.1 #

Initial release - Static file serving for Aim framework

Features #

  • Directory serving: Serve entire directories with serveStatic() middleware
  • Path traversal protection: Built-in security against ../ attacks
  • Dotfile protection: Prevent access to sensitive hidden files (.env, .git, etc.)
  • URL prefix matching: Serve files under specific URL paths with path parameter
  • Index file support: Automatic index.html serving for directory requests
  • Single file serving: Context extension c.file() for serving individual files
  • Download support: Force file downloads with custom filenames
  • MIME type detection: Automatic content-type headers for common file formats

Security #

  • Path normalization and validation to prevent directory traversal
  • Dotfile access control with DotFiles enum (allow/deny/ignore)
  • Absolute path rejection in c.file() method
  • Safe path joining with the path package

Examples #

import 'package:aim_server/aim_server.dart';
import 'package:aim_server_static/aim_server_static.dart';

final app = Aim();

// Basic static file serving
app.use(serveStatic('./public'));

// With URL prefix and index file
app.use(serveStatic('./public',
  path: '/static',
  index: 'index.html',
  dotFiles: DotFiles.deny,
));

// Single file serving
app.get('/download', (c) => c.file('docs/manual.pdf', download: true));
1
likes
160
points
44
downloads

Publisher

verified publisheraim-dart.dev

Weekly Downloads

Static file serving middleware for the Aim framework with security built-in.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

aim_server, mime, path

More

Packages that depend on aim_server_static