heroku-proxy
Advanced tools
Comparing version 0.2.1 to 0.3.0
44
index.js
'use strict'; | ||
var clusterflock = require('clusterflock'); | ||
var express = require('express'); | ||
var harp = require('harp'); | ||
var path = require('path'); | ||
var bouncer = require('./lib/bouncer'); | ||
var cookieSession = require('./lib/cookie-session'); | ||
var api = require('./lib/api'); | ||
var bouncer = require('heroku-bouncer'); | ||
var clusterflock = require('clusterflock'); | ||
var express = require('express'); | ||
var path = require('path'); | ||
var proxy = require('./lib/proxy'); | ||
module.exports = function(app, options) { | ||
var defaultOptions = { | ||
harp : true, | ||
startServer: true, | ||
publicDir : path.join(process.cwd(), 'public') | ||
}; | ||
options || (options = {}); | ||
options.startServer || (options.startServer = true); | ||
@@ -25,28 +18,11 @@ if (typeof app === 'object') { | ||
for (var key in defaultOptions) { | ||
if (!options.hasOwnProperty(key)) { | ||
options[key] = defaultOptions[key]; | ||
} | ||
} | ||
if (!app) app = express(); | ||
if (!app) { | ||
app = express(); | ||
} | ||
bouncer(app); | ||
app.use(express.cookieParser(process.env.COOKIE_SECRET)); | ||
app.use(cookieSession); | ||
bouncer(app); | ||
app.use(express.favicon()); | ||
app.use(express.csrf()); | ||
app.use(express.static(options.publicDir)); | ||
app.use(express.static(path.join(process.cwd(), 'public'))); | ||
app.all('/api/*', proxy); | ||
if (options.harp) { | ||
app.use(harp.mount(options.publicDir)); | ||
} | ||
app.get('/api/*', api.api); | ||
app.post('/api/*', api.api); | ||
app.put('/api/*', api.api); | ||
app.delete('/api/*', api.api); | ||
if (options.startServer) { | ||
@@ -53,0 +29,0 @@ clusterflock(app); |
{ | ||
"name": "heroku-proxy", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "a heroku proxy", | ||
@@ -27,8 +27,7 @@ "main": "index.js", | ||
"express": "~3.4.8", | ||
"harp": "~0.11.2", | ||
"heroku-client": "~1.2.0", | ||
"netrc": "~0.1.3", | ||
"nodemon": "~1.0.16", | ||
"oauth": "~0.9.11" | ||
"heroku-bouncer": "~0.1.0" | ||
} | ||
} |
@@ -32,9 +32,8 @@ # heroku-proxy | ||
Now, running `foreman run nodemon index.js` will serve content inside the `public` | ||
directory and process it with harp.js. Any calls to `/api/*` will be proxied | ||
through the Heroku API. | ||
directory. Any calls to `/api/*` will be proxied through the Heroku API. | ||
## Options | ||
By default, heroku-proxy will use harp middleware and start the server for you. | ||
You can prevent that with the `harp` and `startServer` options: | ||
By default, heroku-proxy will start a server for you. | ||
You can prevent that with the `startServer` option: | ||
@@ -44,6 +43,3 @@ ```javascript | ||
proxy({ | ||
harp: false, | ||
startServer: false | ||
}); | ||
proxy({ startServer: false }); | ||
``` | ||
@@ -58,5 +54,3 @@ | ||
proxy(app, { | ||
harp: false | ||
}); | ||
proxy(app); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
6
0
4267
6
38
54
+ Addedheroku-bouncer@~0.1.0
+ Addedbasic-auth-connect@1.0.0(transitive)
+ Addedbytes@0.3.0(transitive)
+ Addedcompressible@1.0.0(transitive)
+ Addedcompression@1.0.0(transitive)
+ Addedconnect@2.14.5(transitive)
+ Addedconnect-timeout@1.0.0(transitive)
+ Addedcookie@0.1.2(transitive)
+ Addedcookie-parser@1.0.1(transitive)
+ Addedcookie-signature@1.0.3(transitive)
+ Addedcsurf@1.1.0(transitive)
+ Addeddebug@0.7.40.8.0(transitive)
+ Addedencryptor@0.1.0(transitive)
+ Addederrorhandler@1.0.0(transitive)
+ Addedexpress@3.5.3(transitive)
+ Addedexpress-session@1.0.2(transitive)
+ Addedfresh@0.2.20.2.4(transitive)
+ Addedheroku-bouncer@0.1.0(transitive)
+ Addedmerge-descriptors@0.0.2(transitive)
+ Addedmethod-override@1.0.0(transitive)
+ Addedmkdirp@0.4.0(transitive)
+ Addedmorgan@1.0.0(transitive)
+ Addednegotiator@0.4.2(transitive)
+ Addedparseurl@1.0.1(transitive)
+ Addedrange-parser@1.0.01.0.3(transitive)
+ Addedraw-body@1.1.4(transitive)
+ Addedresponse-time@1.0.0(transitive)
+ Addedscmp@0.0.3(transitive)
+ Addedsend@0.3.0(transitive)
+ Addedserve-index@1.0.1(transitive)
+ Addedserve-static@1.1.0(transitive)
+ Addedsetimmediate@1.0.1(transitive)
+ Addedstatic-favicon@1.0.2(transitive)
+ Addedutils-merge@1.0.0(transitive)
+ Addedvhost@1.0.0(transitive)
- Removedharp@~0.11.2
- Removedoauth@~0.9.11
- Removedamdefine@1.0.1(transitive)
- Removedasync@0.2.9(transitive)
- Removedbytes@0.2.0(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcharacter-parser@1.2.0(transitive)
- Removedclean-css@2.0.8(transitive)
- Removedcoffee-script@1.6.3(transitive)
- Removedcolors@0.6.0-1(transitive)
- Removedcommander@0.6.12.0.0(transitive)
- Removedconnect@2.9.0(transitive)
- Removedconstantinople@1.0.2(transitive)
- Removedcss@1.0.8(transitive)
- Removedcss-parse@1.0.4(transitive)
- Removedcss-stringify@1.0.5(transitive)
- Removedcssom@0.2.5(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddiff@1.0.7(transitive)
- Removedejs@0.8.4(transitive)
- Removedfs-extra@0.6.4(transitive)
- Removedglob@3.2.3(transitive)
- Removedgraceful-fs@2.0.3(transitive)
- Removedgrowl@1.7.0(transitive)
- Removedharp@0.11.2(transitive)
- Removedis-promise@1.0.1(transitive)
- Removedjade@0.26.30.35.0(transitive)
- Removedjsonfile@1.0.1(transitive)
- Removedless@1.5.1(transitive)
- Removedlru-cache@2.3.0(transitive)
- Removedmarked@0.2.9(transitive)
- Removedmethods@0.0.1(transitive)
- Removedminimist@0.0.10(transitive)
- Removedmkdirp@0.3.0(transitive)
- Removedmocha@1.13.0(transitive)
- Removedmonocle@1.1.50(transitive)
- Removedmultiparty@2.1.8(transitive)
- Removedncp@0.4.2(transitive)
- Removednode-sass@0.7.0(transitive)
- Removednode-watch@0.3.5(transitive)
- Removedoptimist@0.3.70.6.1(transitive)
- Removedpromise@2.0.0(transitive)
- Removedqs@0.6.5(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedreaddirp@0.2.5(transitive)
- Removedrimraf@2.2.8(transitive)
- Removedsax@0.5.8(transitive)
- Removedsource-map@0.1.340.1.43(transitive)
- Removedstream-counter@0.1.0(transitive)
- Removedstylus@0.40.0(transitive)
- Removedterraform@0.6.2(transitive)
- Removedtransformers@2.1.0(transitive)
- Removeduglify-js@2.2.52.4.02.4.24(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removeduid2@0.0.2(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwith@1.1.1(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedyargs@3.5.4(transitive)