dia_static 0.0.3 copy "dia_static: ^0.0.3" to clipboard
dia_static: ^0.0.3 copied to clipboard

outdated

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.0.3

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.

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
0
pub points
62%
popularity

Publisher

verified publisherawcoding.com

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

convert, dia, mime, path

More

Packages that depend on dia_static