Skip to content

dartup/dartup_package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 bind(defaultAddress,defaultPort) 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();
  });
}

About

Dart package for server delopment on the Dartup platform.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages