angel3_proxy

Last updated:

0 purchases

angel3_proxy Image
angel3_proxy Images
Add to Cart

Description:

angel3 proxy

Angel3 Proxy #




Angel3 middleware to forward requests to another server (i.e. webdev serve). Also supports WebSockets.
import 'package:angel3_proxy/angel3_proxy.dart';
import 'package:http/http.dart' as http;

void main() async {
// Forward requests instead of serving statically.
// You can also pass a URI, instead of a string.
var proxy1 = Proxy('http://localhost:3000');

// handle all methods (GET, POST, ...)
app.fallback(proxy.handleRequest);
}
copied to clipboard
You can also restrict the proxy to serving only from a specific root:
Proxy(baseUrl, publicPath: '/remote');
copied to clipboard
Also, you can map requests to a root path on the remote server:
Proxy(baseUrl.replace(path: '/path'));
copied to clipboard
Request bodies will be forwarded as well, if they are not empty. This allows things like POST requests to function. For a request body to be forwarded, the body must not have already been parsed.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.