0.1.30 • Published 3 years ago

vv-http v0.1.30

Weekly downloads
30
License
MIT
Repository
github
Last release
3 years ago

Install & Use

npm i vv-http
let http = require('vv-http')

let server = http.create({url: 'http://127.0.0.1:3000/subpath'})

// or https with internal self signed cert
// let server = http.create({url: 'https://127.0.0.1:3000/subpath'})
// or https with your cert
// let server = http.create({url: 'https://127.0.0.1:3000/subpath', ssl: {key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem')}})

server.on_error(error => {
    console.log(error)
})

server.on_request(request => {
    console.log(request)
    request.reply(200, 'hi')
})

server.start(error => {
    if (error) {
        console.log(error)
    } else {
        console.log('START')
    }

    //send GET message to started server
    http.get('http://127.0.0.1:3000/subpath?a=5&b=7', undefined, (error, buffer)  => {
        if (error) {
            console.log(error)
        } else {
            console.log(buffer.toString('utf8'))
        }
    })
})
```## Functions

<dl>
<dt><a href="#create">create([options])</a></dt>
<dd></dd>
</dl>

## Typedefs

<dl>
<dt><a href="#app">app</a> : <code>lib_app</code></dt>
<dd></dd>
<dt><a href="#constructor_options">constructor_options</a> : <code>type.constructor_options</code></dt>
<dd></dd>
<dt><a href="#request">request</a> : <code>type.request</code></dt>
<dd></dd>
<dt><a href="#request_method">request_method</a> : <code>type.request_method</code></dt>
<dd></dd>
<dt><a href="#function_reply">function_reply</a> : <code>type.function_reply</code></dt>
<dd></dd>
</dl>

<a name="create"></a>

## create([options])
**Kind**: global function  

| Param | Type |
| --- | --- |
| [options] | [<code>constructor\_options</code>](#constructor_options) | 

<a name="app"></a>

## app : <code>lib\_app</code>
**Kind**: global typedef  
<a name="constructor_options"></a>

## constructor\_options : <code>type.constructor\_options</code>
**Kind**: global typedef  
<a name="request"></a>

## request : <code>type.request</code>
**Kind**: global typedef  
<a name="request_method"></a>

## request\_method : <code>type.request\_method</code>
**Kind**: global typedef  
<a name="function_reply"></a>

## function\_reply : <code>type.function\_reply</code>
**Kind**: global typedef  
0.1.30

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.27

4 years ago

0.1.25

4 years ago

0.1.26

4 years ago

0.1.24

4 years ago

0.1.21

4 years ago

0.1.22

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.14

4 years ago

0.1.10

4 years ago

0.1.12

4 years ago

0.1.8

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago