Gulp – connect proxy example

It will avoid CORS problem during development.

var Proxy = require('gulp-connect-proxy');
// A local web server for dev convenience
gulp.task("server", function() {
	  root: "./dist",
	  port: 22532,
          middleware: function (connect, opt) {
	      opt.route = '/proxy';
	      var proxy = new Proxy(opt);
	      return [proxy];

Example of calling API

return $http.get(
  { params: { metricSelector: "hello2"} }

Gulp connect web site

This entry was posted in Programming, Web and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s