1.1.5 • Published 4 years ago

node-express-php-client v1.1.5

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

ABANDONED

Use node-express-http-manager instead!


node-express-php-client

Php Client for the ExpressJS

Usage

const express = require('express');
const PhpClient = require('node-express-php-client');

const app = express();

app.use((req, res, next) => {
    req.state = {};
    req.phpClient = performPhpClient();
    return next();
});

// Pass all requests to the php service:
app.use('/', (req, res) => req.phpClient.useLocation().pass(req, res));

// Pass `/slow` prefixed requests to the slow php service:
app.use('/slow', (req, res) => req.phpClient.useLocation('slow').pass(req, res));


function performPhpClient() {
    // Create an instance with a default location:
    const phpClient = new PhpClient('common', {
        location: 'http://127.0.0.1:8380'
    });

    // Add a `slow` location:
    phpClient.addLocation('slow', {
        location: 'http://127.0.0.1:8381'
    });

    return phpClient;
}
1.1.5

4 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago