Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route api calls to backend #17

Open
cjh9 opened this issue Jan 20, 2018 · 6 comments · May be fixed by #40
Open

Route api calls to backend #17

cjh9 opened this issue Jan 20, 2018 · 6 comments · May be fixed by #40

Comments

@cjh9
Copy link

cjh9 commented Jan 20, 2018

Great plugin! Is it possible to route API-calls to the real backend, for instance localhost:3000 like this https://vuejs-templates.github.io/webpack/proxy.html?

@thgh
Copy link
Owner

thgh commented Jan 22, 2018

Currently it's not, but I will accept PRs that implement options from webpack-dev-server or a subset thereof.

@hronro
Copy link

hronro commented Mar 26, 2018

It would be awesome if can set proxy in this plugin😁

@christiangelone
Copy link

Has anyone pr this feature?

@calebdwilliams
Copy link

@thgh, Would you be interested in a primitive version of the proxy feature as a start. I have it working right now, but only for the

serve({
  proxy: {
    api: 'http://localhost:7777'
  }
}

syntax. The advanced syntax wouldn't be much more difficult to implement, but I don't have the bandwidth right now.

This was referenced Jul 24, 2019
@hyperupcall
Copy link

any update on this?

i was using @calebdwilliams's fork, but things did not quite work out when was using busboy. would love to see any implementation

@krishnagopinath
Copy link

krishnagopinath commented May 5, 2020

FWIW, I've been using @pearofducks rollup-plugin-dev and it's been working splendidly for me -- https://github.com/pearofducks/rollup-plugin-dev

I come from webpack and this has been a great transition from WDS! This is how I use it in rollup.config.js:

plugins: [
	....

	// In dev mode, serve API under a proxy, so we needn't inject
	// api url into the app.
	!production && dev({
		dirs: ['public'],
	 	port: 3000,
 		proxy: { '/api/*': 'http://localhost:12345/' },
 		spa: true,
	}),

	....
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants