Git Product home page Git Product logo

node-fastcgi-client's Introduction

node-fastcgi-client

A FastCGI client implementation in Node.js, mainly designed for cummunication with PHP.

Development Status

Developing. Would be stable soon.

API

npm install fastcgi-client. Use require('fastcgi-client') to get a fastcgiConnector.

var client = fastcgiConnector(options) Create a FastCGI client. Available options:

  • host The server name or IP, default to '127.0.0.1'.
  • port The server port, default to 9000.
  • sockFile Connect to php-fpm with sock file instead of 127.0.0.1:9000. If you set this option, host and port will be ignored
  • skipCheckServer Skip checking and getting options from the server.
  • maxConns The default value of maximum concurrent connections to the server.
  • maxReqs The default value of maximum concurrent requests to the server.
  • mpxsConns The default value of using concurrency over connections or not.
  • Event ready Client is ready for accepting request.
  • Event error An error occurred and returned as 1st argument of event handler.

client.request(params, cb) Create a new request. params Should be FastCGI params (key-value pairs). An error object would be passed to cb as 1st argument on failed (request not sent at all), otherwise a request argument is passed as 2nd argument.

The request object:

  • request.abort() Send an abort request. The request is not ended after the server responds.
  • request.stdin The writable stdin stream.
  • request.stdout The readable stdout stream.
  • request.stderr The readable stderr stream.
  • request.getExitStatus() Return exit code, or an error if not normally ended. It would be ready before the end events of stdout and stderr streams.

test

You should have PHP-CGI installed and PHP5 FPM service running in 127.0.0.1:9000.

Then use npm test to test. Use npm run coverage to see the test coverage.

LICENSE

MIT

node-fastcgi-client's People

Contributors

lastleaf avatar longbill avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.