Skip to content

agilord/http_request_proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP request proxy

Proxy HTTP requests to other server (typically from Dart backend to pub serve during development).

Usage

A simple usage example:

import 'dart:io';
import 'package:http_request_proxy/http_request_proxy.dart';

main() {
  var proxy = new HttpRequestProxy('localhost', 8000);
  HttpServer server = await HttpServer.bind(InternetAddress.ANY_IP_V4, 3333);
  server.listen((request) {
    if (request.uri.path.startsWith('/api/')) {
      // handle API call
    } else {
      // proxy to local pub serve
      proxy.proxyHttpRequest(request);
    }
  });
}

Links

About

Proxy HTTP requests to other server (typically from Dart backend to pub serve during development).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages