Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,809 additions
and
2,861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var browserSync = require('browser-sync').create(); | ||
var proxy = require('../../index'); // require('http-proxy-middleware'); | ||
var browserSync = require('browser-sync').create() | ||
var proxy = require('../../index') // require('http-proxy-middleware'); | ||
|
||
/** | ||
* Configure proxy middleware | ||
*/ | ||
var jsonPlaceholderProxy = proxy('/users', { | ||
target: 'http://jsonplaceholder.typicode.com', | ||
changeOrigin: true, // for vhosted sites, changes host header to match to target's host | ||
logLevel: 'debug' | ||
}); | ||
target: 'http://jsonplaceholder.typicode.com', | ||
changeOrigin: true, // for vhosted sites, changes host header to match to target's host | ||
logLevel: 'debug' | ||
}) | ||
|
||
/** | ||
* Add the proxy to browser-sync | ||
*/ | ||
browserSync.init({ | ||
server: { | ||
baseDir: './', | ||
port: 3000, | ||
middleware: [jsonPlaceholderProxy], | ||
}, | ||
startPath: '/users' | ||
}); | ||
server: { | ||
baseDir: './', | ||
port: 3000, | ||
middleware: [jsonPlaceholderProxy] | ||
}, | ||
startPath: '/users' | ||
}) | ||
|
||
console.log('[DEMO] Server: listening on port 3000'); | ||
console.log('[DEMO] Opening: http://localhost:3000/users'); | ||
console.log('[DEMO] Server: listening on port 3000') | ||
console.log('[DEMO] Opening: http://localhost:3000/users') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var http = require('http'); | ||
var connect = require('connect'); | ||
var proxy = require('../../index'); // require('http-proxy-middleware'); | ||
var http = require('http') | ||
var connect = require('connect') | ||
var proxy = require('../../index') // require('http-proxy-middleware'); | ||
|
||
/** | ||
* Configure proxy middleware | ||
*/ | ||
var jsonPlaceholderProxy = proxy({ | ||
target: 'http://jsonplaceholder.typicode.com', | ||
changeOrigin: true, // for vhosted sites, changes host header to match to target's host | ||
logLevel: 'debug' | ||
}); | ||
target: 'http://jsonplaceholder.typicode.com', | ||
changeOrigin: true, // for vhosted sites, changes host header to match to target's host | ||
logLevel: 'debug' | ||
}) | ||
|
||
var app = connect(); | ||
var app = connect() | ||
|
||
/** | ||
* Add the proxy to connect | ||
*/ | ||
app.use('/users', jsonPlaceholderProxy); | ||
app.use('/users', jsonPlaceholderProxy) | ||
|
||
http.createServer(app).listen(3000); | ||
http.createServer(app).listen(3000) | ||
|
||
console.log('[DEMO] Server: listening on port 3000'); | ||
console.log('[DEMO] Opening: http://localhost:3000/users'); | ||
console.log('[DEMO] Server: listening on port 3000') | ||
console.log('[DEMO] Opening: http://localhost:3000/users') | ||
|
||
require('opn')('http://localhost:3000/users'); | ||
require('opn')('http://localhost:3000/users') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var express = require('express'); | ||
var proxy = require('../../index'); // require('http-proxy-middleware'); | ||
var express = require('express') | ||
var proxy = require('../../index') // require('http-proxy-middleware'); | ||
|
||
/** | ||
* Configure proxy middleware | ||
*/ | ||
var jsonPlaceholderProxy = proxy({ | ||
target: 'http://jsonplaceholder.typicode.com', | ||
changeOrigin: true, // for vhosted sites, changes host header to match to target's host | ||
logLevel: 'debug' | ||
}); | ||
target: 'http://jsonplaceholder.typicode.com', | ||
changeOrigin: true, // for vhosted sites, changes host header to match to target's host | ||
logLevel: 'debug' | ||
}) | ||
|
||
var app = express(); | ||
var app = express() | ||
|
||
/** | ||
* Add the proxy to express | ||
*/ | ||
app.use('/users', jsonPlaceholderProxy); | ||
app.use('/users', jsonPlaceholderProxy) | ||
|
||
app.listen(3000); | ||
app.listen(3000) | ||
|
||
console.log('[DEMO] Server: listening on port 3000'); | ||
console.log('[DEMO] Opening: http://localhost:3000/users'); | ||
console.log('[DEMO] Server: listening on port 3000') | ||
console.log('[DEMO] Opening: http://localhost:3000/users') | ||
|
||
require('opn')('http://localhost:3000/users'); | ||
require('opn')('http://localhost:3000/users') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
var HPM = require('./lib'); | ||
var HPM = require('./lib') | ||
|
||
module.exports = function(context, opts) { | ||
return new HPM(context, opts); | ||
}; | ||
module.exports = function (context, opts) { | ||
return new HPM(context, opts) | ||
} |
Oops, something went wrong.