# gateway

> Middleware to execute CGI scripts

Latest version **1.0.0** (published 2014-08-29) · 0 weekly downloads

## Install

```sh
npm install gateway
pnpm add gateway
yarn add gateway
bun add gateway
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-08-29 |
| First published | 2012-08-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36 |
| Author | Felix Gnass |
| Maintainers | fgnass |
| Keywords | connect, middleware, cgi, php |

## Links

- npm: https://www.npmjs.com/package/gateway
- Repository: https://github.com/fgnass/gateway
- Homepage: http://github.com/fgnass/gateway
- Issues: https://github.com/fgnass/gateway/issues
- npm.io page: https://npm.io/package/gateway

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-08-29
- 0.2.1 — 2014-04-22
- 0.2.0 — 2014-04-22
- 0.1.1 — 2012-09-17
- 0.1.0 — 2012-08-30
- 0.0.1 — 2012-08-27

## README

# gateway
## Node.js middleware to execute CGI scripts

[![Build Status](https://secure.travis-ci.org/fgnass/gateway.png)](http://travis-ci.org/fgnass/gateway)

Purpose of this module is to allow development tools like
[Yeoman](http://yeoman.io) or [Livestyle](https://github.com/One-com/livestyle)
to serve PHP files (and possibly other scripting languages) directly.

To make this work you need the `php-cgi` binaray in your PATH.

## Usage

```javascript
var http = require('http');
var gateway = require('gateway');

var app = http.createServer(gateway(__dirname, {
  '.php': 'php-cgi'
}))
```

### Usage with command line arguments
```javascript
var http = require('http');
var gateway = require('gateway');

var app = http.createServer(gateway(__dirname, {
  '.php': ['php-cgi', '-d', 'auto_prepend_file=/path/to/auto_prepended.php']
  }
}))
```

## Installing php-cgi

The `php-cgi` binary can be installed via Homebrew by tapping the
[homebrew-php](https://github.com/josegonzalez/homebrew-php) repository:

    brew tap homebrew/dupes
    brew tap josegonzalez/homebrew-php
    brew install php54

## Directories

If the middleware encounters a URL that points to a directory, it will look for
an index file matching any of the registered extensions. If the URL points to a
valid directory but the path does not end with a slash, a permanent redirect is
sent.

The gateway middleware doesn't support `cgi-bin` directories. If you want to
serve CGI scripts with a shebang please use [node-cgi](https://github.com/TooTallNate/node-cgi) instead.

## License

(The MIT License)

Copyright (c) 2012 Felix Gnass

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
_Source: https://npm.io/package/gateway · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
