Skip to content

Commit efac422

Browse files
authored
Correct errors in README, add POST example
Fix #14
1 parent 5a61a38 commit efac422

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ node-fastcgi
99

1010
[![NPM](https://nodei.co/npm/node-fastcgi.png?downloads=true)](https://nodei.co/npm/node-fastcgi/)
1111

12-
This module is a drop-in replacement for node's http module (server only). It can be used to build FastCGI applications or to convert existing node applications to FastCGI.
12+
This module is a drop-in replacement for node's standard http module (server only). Code written for a http server should work without changes with FastCGI. It can be used to build FastCGI applications or to convert existing node applications to FastCGI.
1313

1414
The implementation is fully compliant with the [FastCGI 1.0 Specification](https://fast-cgi.github.io/spec).
1515

@@ -24,6 +24,14 @@ fcgi.createServer(function(req, res) {
2424
if (req.method === 'GET') {
2525
res.writeHead(200, { 'Content-Type': 'text/plain' });
2626
res.end("It's working");
27+
} else if (req.method === 'POST') {
28+
res.writeHead(200, { 'Content-Type': 'text/plain' });
29+
var body = "";
30+
31+
req.on('data', function(data) { body += data; });
32+
req.on('end', function() {
33+
res.end("Received data:\n" + body);
34+
});
2735
} else {
2836
res.writeHead(501);
2937
res.end();
@@ -143,7 +151,7 @@ The socket object exposes three additional properties:
143151
http module compatibility
144152
-------------------------
145153

146-
The API is almost compatible with http module from node v0.12 all the way to v6.2 (the current version). Only the server API is implemented.
154+
The API is almost compatible with the http module from node v0.12 all the way to v6.x (the current series). Only the server API is implemented.
147155

148156
Differences:
149157
- A FastCGI server will never emit `'checkContinue'` and `'connect'` events because `CONNECT` method and `Expect: 100-continue` headers should be handled by the front-end http server

0 commit comments

Comments
 (0)