We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 924d5e7 commit 85c4ba7Copy full SHA for 85c4ba7
1 file changed
examples/server.proxy.js
@@ -0,0 +1,28 @@
1
+/**
2
+ *
3
+ * Install:
4
+ * npm install browser-sync express http-proxy-middleware
5
6
+ * Run:
7
+ * node <yourfile.js>
8
9
+ * This example will create a server in the cwd whilst proxying requests
10
+ * to /api to a backend
11
12
+ */
13
+
14
+"use strict";
15
16
+var browserSync = require("browser-sync").create();
17
+var express = require('express');
18
+var proxy = require('http-proxy-middleware');
19
20
+var app = express();
21
22
+app.use('/api', proxy({target: 'http://www.example.org', changeOrigin: true}));
23
24
+browserSync.init({
25
+ server: ".",
26
+ watch: true,
27
+ middleware: [app]
28
+});
0 commit comments