News from the world of Node:, copromise, Apper

Original author: Alex Young
  • Transfer is a module for remote procedure call (RPC) that uses promises. Using it, you can create such a server:

var server = new PromiseIO({
  someFunc: function(input) {
    return 'I got: ' + input;

The client can call someFuncafter connecting to the server:

var client = new PromiseIO();
client.connect('http://localhost:3000').then(function(remote) {
  return remote.someFunc('my variable!');
}).then(function(returnVal) {
  return console.log(returnVal);
}).catch(function(err) {
  return console.log(err);

To implement the "promises", under the hood, q is used .


Copromise is a bit like co , but this library automatically returns values ​​that are not “promises”, so you always have the opportunity to get something using it yield.

Copromise is a possible coroutine value . Where coroutine is a generator function that uses a keyword yield to pause startup and wait for a future value. This approach allows to obtain linear control of the execution (following) logic for asynchronous code.

Dean, announced this on the node.js list with several examples of use and comparison with the co library .

function run(coroutine) {
    return new Promise(function(resolve, reject) {
        (function next(value, exception) {
            var result;
            try {
                result = exception ? coroutine.throw(value) :;
            } catch (error) {
                return reject(error);
            if (result.done) return resolve(result.value);
            Promise.resolve(result.value).then(next, function(error) {
                next(error, true);


Apper is a real-time framework for single-station applications. The idea is to have reinforced concrete agreements for the practical use of single-page applications, including transparent minification and bundling.

The above framework is an over- Express wrapper, so the definition of routes looks like in a regular Express project , although Apper has specific sections for things like middleware or application settings.

For instance:

var app = require('apper')({
    path: '.',
    port: 8000,
    host: '',
    // Not commonly used. Just use `apper.json` for the configuration
    toOpenBrowser: false,
    staticContentName: 'public',
    moduleNames: {
        environment: 'environment'
        middleware: 'middleware',
        routes: 'routes',
        sockets: 'sockets'
    mountPath: ''

Where middleware.js will be:

module.exports = function (app) {
    app.use(function (req, res, next) {
        // middleware code

If you are unfamiliar with Express , then you might like to work with the conventions that Apper uses, this approach will at least save you from the tendency to store everything in one large (monolithic) file app.js.


  • (GitHub: krillr / , Lick: Apache 2.0, npm: ) by Aaron Krill.
  • Copromise: (GitHub: deanlandolt / copromise , License: MIT, npm: copromise ) by Dean Landolt.
  • Apper: (GitHub: asyncanup / apper , License: MIT, npm: apper ) by Anup Bishno.
  • In my opinion, the basic idea that Apper is a kind of guide and over-framework in the world of "structured ++" Express applications is not quite expressed here .

Also popular now: