les 0.0.3+1 copy "les: ^0.0.3+1" to clipboard
les: ^0.0.3+1 copied to clipboard

outdated

Light Efficient Server - for creating servers on Dart. Inspired by ExpressJS and Koa.

example/example.dart

import 'package:les/les.dart';

void main(List<String> args) {
  // Creates instance of [Server]
  Server()
  // Add middlewares
  ..use(bodyParser)
  ..use(buildStaticFilesHandler())
  // Add [Routes]
    ..add(routes)
    // Start listen for requests
    ..listen(7575);
}

// Define [Route]s that describe answers for concrete requests
final routes = Router('/')
  ..add(Route(
        // Path will be transformed to RegExp 
        r':a(\d+)',
        (ctx) => ctx.send('Hello get')
      ))
  ..add(Route(
      'af/af',
      (ctx) => ctx.send('Hello post'),
      method: HttpMethod.post
      ));
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Light Efficient Server - for creating servers on Dart. Inspired by ExpressJS and Koa.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http_server, path_to_regexp

More

Packages that depend on les