Thin API wrappers around Node's dnode
and PHP's erasys/dnode-php-sync-client
for improved developer ergonomy.
Example from the original dnode
:
var server = dnode({
transform : function (s, cb) {
cb(s.replace(/[aeiou]{2,}/, 'oo').toUpperCase())
}
});
The same example with p_dnode
:
const server = p_dnode({
transform (s) {
return s.replace(/[aeiou]{2,}/, 'oo').toUpperCase()
}
})
Tip: For asynchronous operations, return a Promise / use async
functions.
Example from erasys/dnode-php-sync-client
:
$dnode = new \DnodeSyncClient\Dnode();
$connection = $dnode->connect('localhost', 8080);
$response = $connection->call('echo', array('Hello, world!'));
var_dump($response);
The same example used with the DNode
wrapper:
$connection = Dnode::connect('localhost', 8080);
$response = $connection->echo('Hello, world!');
var_dump($response);