Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Merge pull request #3 from fidian/master

MIT license + npm package.json
latest commit 9e8507dffb
Brian McKenna authored
Failed to load latest commit information.
cgi.js Standardize whitespace (consistent indendataion)
package.json Initial commit so this library can go into npm's list Adding MIT license, since Brian favors that one


This library is a CGI adaptor for node.js

It is designed to help people run node.js websites off of a shared server (CGI is so old it's available almost everywhere).


You'll have to create a .htaccess file that rewrites everything to a CGI script:

Options +ExecCGI
AddHandler cgi-script cgi

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) server.cgi

Copy cgi.js to the same directory and make the actual CGI script (server.cgi in this example):

#!/usr/bin/env node

var cgi = require('./cgi');

var server = cgi.createServer(function(request, response) {
    response.writeHead(200, {'Content-Type': 'text/plain'});
    response.write('This is CGI!');

As you can see, using the cgi library is very similar to the http library in node.js


The cgi.js library is released under an MIT license. See LICENSE for the full text of the license.

Something went wrong with that request. Please try again.