ptwebserver 0.2.4

ptWebServer is a configuration web server that supports multiple hosts and addresses. It can be as simple as a simple web server with no extras to a very custom server response.

Warning: You must close the response when using a custom request callback

PHP execution

In your config, you may enable PHP and give it the path to PHP and using a little magic, send PHP responses. It should also pass along variables as well to both $_POST , $_GET and $_REQUEST appropriately. However, data beyond that point is currently not supported.

This feature has been tested mildly and in Linux.

Example usage:

import 'package:ptwebserver/ptwebserver.dart';

void main() {
  ptConfig cfg = new ptConfig();
  cfg.servername = "DCS_Intranet";

  ptHost host = new ptHost();
  host.name = "test";
  host.address = "127.0.0.1";
  host.port = 8080;
  host.hostnames.add("test");

  host.public_path = "/var/www/";
  host.SetDefaultHandlers();
  host.public_index_files.add("index.html");
  host.public_index_files.add("index.php");
  host.public_index_files.add("index.htm");

  host.allow_dir_view = true;

  cfg.hosts.add(host);

  ptWebServer server = new ptWebServer(cfg);

  server.Run();
}

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  ptwebserver: ">=0.2.4 <0.3.0"

If your package is an application package you should use any as the version constraint.

2. Install it

If you're using the Dart Editor, choose:

Menu > Tools > Pub Install

Or if you want to install from the command line, run:

$ pub install

3. Import it

Now in your Dart code, you can use:

import 'package:ptwebserver/ptwebserver.dart';

About

Configurable web server. Currently has PHP support. More language support to come.

Author

Email ptdave20@gmail.com David Marchbanks

Homepage

https://github.com/ptdave20/ptwebserver

Uploader

ptdave20

Share