dia_static 0.1.1 icon indicating copy to clipboard operation
dia_static: ^0.1.1 copied to clipboard

The middleware for Dia http server, for serving static files. Make Dia in webserver for static content).

Pub Package

The middleware for Dia for serving static files.

Install: #

Add to pubspec.yaml in dependencies section this:

    dia_static: ^0.1.0

Then run pub get

Usage: #

A simple usage example:

import 'package:dia/dia.dart';
import 'package:dia_static/dia_static.dart';

void main() {
  final app = App();

  /// Serve files from example folder
  app.use(serve('./example'));

  app.use((ctx, next) async {
    ctx.body ??= 'error';
  });

  /// Start server listen on localhost:8080
  app
      .listen('localhost', 8080)
      .then((info) => print('Server started on http://localhost:8080'));
}

Params: #

  • root - path to webserver root directory
  • prefix - url mast start with prefix value, optional.
  • index - default index file for serving if uri end with /. Default: null

Use with: #

  • dia - A simple dart http server in Koa2 style.
  • dia_router - Middleware like as koa_router.
  • dia_body - Package with the middleware for parse request body.
  • dia_cors - Package for CORS middleware.

Features and bugs: #

I will be glad for any help and feedback! Please file feature requests and bugs at the issue tracker.

1
likes
130
pub points
21%
popularity

Publisher

verified publisher iconawcoding.com

The middleware for Dia http server, for serving static files. Make Dia in webserver for static content).

Homepage

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

convert, dia, mime, path

More

Packages that depend on dia_static