2.6.3 • Published 9 months ago

fast-restapi2 v2.6.3

Weekly downloads
5
License
LGPL-3.0
Repository
github
Last release
9 months ago

fast-restapi 2

Fast http api server

module type es6 ready

npm install --save fast-restapi2
import server from 'fast-restapi2';

class TestController {

  /**
   * index
   *
   * @static
   * @param  {import('../node_modules/fast-restapi2/lib/ClientWrapper.js').default} client - Client request, response wrapper.
   * @param {Array} params - url parts as strings
   */
  static index(client,params){
    // http://127.0.0.1:9022/api/index
    client.serve(200,{'joe':['bar']});
  };
  /**
   * visitme
   *
   * @static
   * @param  {import('../node_modules/fast-restapi2/lib/ClientWrapper.js').default} client - Client request, response wrapper.
   * @param {Array} params - url parts as strings
   */
  static visitme(client,params){
    // http://127.0.0.1:9022/api/visitme/param1/param2
    client.serve(200,{params:params});
  };
}

server.create('api',{port:9022,host:'127.0.0.1'},TestController).then((res){
  console.log(res)
}).catch((error) => {
  console.error(error);
});

process.stdin.resume();
2.6.3

9 months ago

2.6.1

2 years ago

2.6.0

2 years ago

2.4.1

2 years ago

2.4.3

2 years ago

2.4.2

2 years ago

2.4.4

2 years ago

2.4.0

2 years ago

2.3.4

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.3

3 years ago

2.2.0

3 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago