dartup 0.9.0 copy "dartup: ^0.9.0" to clipboard
dartup: ^0.9.0 copied to clipboard

Dart 1 only

Library for servers on the dartup platform.

A required library for the Dartup alpha. That gives you the runtime configuration to run your service on the Dartup platform.

Quick api overview: #

Most of these functions have arguments in from of default argument that is used when not running on the Dartup platform.

  • bool onDartup() Returns true if running on Dartup
  • int httpPort(defaultPort) return port you need listen to get traffic from the proxy.
  • String httpAddress(defaultAddress) return ip you need to listen get traffic from the proxy.
  • Future a convenient Dartup version of HttpServer.bind
  • String mainDomain() get the domain you are configured as. Only works if onDartup is true.

Quick example: #

import 'dart:io';
import 'package:dartup/dartup.dart' as dartup;

main() async{
  HttpServer server = await dartup.bind('localhost',8080);
  server.listen((HttpRequest request){
    if(dartup.onDartup()){
      request.response.write('Hello world from Dartup');
    }else{
      request.response.write('Hello world');
    }
    request.response.close();
  });
}
0
likes
15
pub points
10%
popularity

Publisher

unverified uploader

Library for servers on the dartup platform.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on dartup