Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

heroku-proxy

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-proxy - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

.env

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);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc