Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xtx1130/node-interface
use koa2 to establish a middle ware
https://github.com/xtx1130/node-interface
koa2 middleware node
Last synced: 3 months ago
JSON representation
use koa2 to establish a middle ware
- Host: GitHub
- URL: https://github.com/xtx1130/node-interface
- Owner: xtx1130
- License: mit
- Created: 2017-04-20T03:27:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-12T07:13:05.000Z (over 7 years ago)
- Last Synced: 2024-09-30T07:03:58.728Z (3 months ago)
- Topics: koa2, middleware, node
- Language: JavaScript
- Homepage:
- Size: 52.7 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# node-interface
[![NPM](https://nodei.co/npm/node-interface.png?compact=true)](https://nodei.co/npm/node-interface/)
[![Package Quality](http://npm.packagequality.com/shield/node-interface.svg)](http://packagequality.com/#?package=node-interface)
[![Build Status](https://travis-ci.org/xtx1130/node-interface.svg?branch=master)](https://www.npmjs.com/package/node-interface)
[![Coverage Status](https://coveralls.io/repos/github/xtx1130/node-interface/badge.svg?branch=master)](https://coveralls.io/github/xtx1130/node-interface?branch=master)
[![npm (tag)](https://img.shields.io/npm/v/npm/next.svg)](https://www.npmjs.com/package/node-interface)
[![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg)]()
> middle ware for front-engineer to server## simple server for api merge
### usage:
```bash
npm install node-interface
cd ./node-interface
sudo npm install
``````bash
sh ./bin/start.sh n (n means how many ports will be listened(8030+n))
```### examples:
```js
$.ajax({
url:'http://127.0.0.1:8031',
type:'post',
data:{
0:{
url:'http://url',
type:'get',
data:'uId=1'//use key=value&key=value, beacuse this is get method
},
1:{
url:'http://url',
type:'post',
data:{uId:1}//use object , because this is post method
}
},
success:function(data){
console.log(JSON.parse(data))//the data is an Array ,and it include [data[0],data[1]]
}
})
```
+ node-interface will help you to request data[0].url && data[1].url and merge the response return back to users+ The success data has contained data[0]&data[1] result;
+ server client must has restful API status to ensure node can check,API status changes in ./app/deps/httpRequest line 34
### 1.0.0 version
+ project established
### 1.1.0 version
+ add testing
### 1.3.0 version
+ add post method
### 1.5.0 version
+ add other routers for 404,only /apis can be readed
+ add start.sh to establish pm2 cluster usage: sh start.sh + n (n means how many ports will get start)### 1.7.3 version
+ change readme
+ add koa-helmet(has been noted in index.js)### 1.9.0 version
+ change router,make apis first
### 2.0.0 version
+ add LICENSE and add coverage
### issues
+ add issues in [here](https://github.com/xtx1130/node-interface/issues "issue")
### License+ MIT