The Protevus Platform: Unified Full-Stack Development https://protevus.com
Find a file
2018-03-20 17:38:22 +01:00
.idea 1.1.0-alpha 2017-09-24 14:49:18 -04:00
.vscode 1.0.8 2017-06-20 15:31:35 -04:00
example 1.1.0-alpha 2017-09-24 14:49:18 -04:00
lib (fix) removed deprecated io reference, removed transfer-encoding from response headers 2018-03-20 17:38:22 +01:00
test Fixed test 2017-09-24 14:51:47 -04:00
.gitignore Works 2016-11-23 17:03:06 -05:00
.travis.yml Works 2016-11-23 17:03:06 -05:00
analysis_options.yaml 1.1.0-alpha 2017-09-24 14:49:18 -04:00
LICENSE Initial commit 2016-11-09 23:28:11 -05:00
pubspec.yaml Bump to 1.1.0 2017-12-07 01:13:12 -05:00
README.md 1.1.0-alpha 2017-09-24 14:49:18 -04:00

proxy

Pub build status

Angel middleware to forward requests to another server (i.e. pub serve).

import 'package:angel_proxy/angel_proxy.dart';
import 'package:http/http.dart' as http;

main() async {
  // ...
  
  var client = new http.Client();
  var proxy = new Proxy(app, client, 'http://localhost:3000');
  
  // Forward requests instead of serving statically
  app.use(proxy.handleRequest);
}

You can also restrict the proxy to serving only from a specific root:

new Proxy(app, client, '<host>', publicPath: '/remote');

Also, you can map requests to a root path on the remote server

new Proxy(app, client, '<host>', mapTo: '/path');

If your app's storeOriginalBuffer is true, then request bodies will be forwarded as well, if they are not empty. This allows things like POST requests to function.