{"id":17736655,"url":"https://github.com/parro-it/comws","last_synced_at":"2025-05-08T20:38:21.265Z","repository":{"id":28506166,"uuid":"32022666","full_name":"parro-it/comws","owner":"parro-it","description":"koa-like generator middlewares for any apps (not just webserver!)","archived":false,"fork":false,"pushed_at":"2020-06-03T09:18:26.000Z","size":104,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-26T09:38:38.974Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parro-it.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-11T14:39:59.000Z","updated_at":"2020-05-19T02:52:16.000Z","dependencies_parsed_at":"2022-09-03T02:43:15.590Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/comws","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fcomws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fcomws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fcomws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fcomws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/comws/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253146864,"owners_count":21861480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T00:23:56.609Z","updated_at":"2025-05-08T20:38:21.230Z","avatar_url":"https://github.com/parro-it.png","language":"JavaScript","readme":"# comws\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/parro-it/comws.svg)](https://greenkeeper.io/)\n\n\u003e Expressive middleware for node.js using generators via [co](https://github.com/visionmedia/co) to make node applications more enjoyable to write. Comws middleware flow in a stack-like manner exactly like koa ones. Use of generators also greatly increases the readability and robustness of your application.\n\n[![Travis Build Status](https://img.shields.io/travis/parro-it/comws.svg)](http://travis-ci.org/parro-it/comws)\n[![NPM module](https://img.shields.io/npm/v/comws.svg)](https://npmjs.org/package/comws)\n[![NPM downloads](https://img.shields.io/npm/dt/comws.svg)](https://npmjs.org/package/comws)\n\n# Installation\n\n```bash\nnpm install comws --save\n```\n\nComws is supported in all versions of node \u003e 4.\n\n# Getting started\n\nSee all examples in example folder to get started.\n\nOpen an issue if you have any question or suggestion.\n\n# Example\n\n```js\nconst CoMws = require('comws');\nconst mws = new CoMws();\n\nmws.use(function *(next){\n  this.result += ' hello';\n  yield next();\n});\n\nmws.use(function *(next){\n  this.result += ' world';\n  yield next();\n});\n\nconst ctx = {result: 'yet another'};\n\nmws.run(ctx).then(function() {\n  //ctx.result === 'yet another hello world'\n});\n\n```\n\n# Use multiple middlewares\n\nStarting from version 2.1, you can also\nuse multiple middleware in the same `use` call:\n\n```js\nconst CoMws = require('comws');\nconst {mw1, mw2} = require('middlewares');\n\nconst mws = new CoMws();\n\nmws.use(mw1, mw2);\n```\n\nor also chain `use` calls:\n\n```js\nconst CoMws = require('comws');\nconst {mw1, mw2} = require('middlewares');\n\nconst mws = new CoMws();\n\nmws.use(mw1).use(mw2);\n```\n\n# Running tests\n\n```\n$ npm install \u0026\u0026 npm test\n```\n\n\n# License\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 parro-it\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fcomws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Fcomws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fcomws/lists"}