Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yujinlim/simple-tcp-server
A Simple TCP server framework with koa style middlewares
https://github.com/yujinlim/simple-tcp-server
Last synced: 15 days ago
JSON representation
A Simple TCP server framework with koa style middlewares
- Host: GitHub
- URL: https://github.com/yujinlim/simple-tcp-server
- Owner: yujinlim
- License: mit
- Created: 2015-12-06T11:46:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-06T11:57:04.000Z (about 9 years ago)
- Last Synced: 2024-11-07T18:03:56.837Z (2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple TCP [![Build Status](https://travis-ci.org/yujinlim/simple-tcp-server.svg)](https://travis-ci.org/yujinlim/simple-tcp-server)
A simple TCP server using [koa](https://github.com/koajs/koa) styles and syntax with ES6 generators.## Installation
```
npm i --save simple-tcp-server
```## Example
```js
var TCP = require('simple-tcp-server');
var app = new TCP();app.use(function *(next) {
this.state.user = yield db.getUser();
yield next;
});app.use(function *() {
this.body = this.state.user;
});var server = app.listen(1337);
server.on('error', function(err) {
console.error(err);
});
```## Related
- [`koa`](https://github.com/koajs/koa)## License
Released under the [MIT License](http://www.opensource.org/licenses/MIT).