1.0.7 • Published 6 years ago

node-net v1.0.7

Weekly downloads
15
License
MIT
Repository
github
Last release
6 years ago

Simple server for Node.js

Pure Package, Simple Code, Use 'this' keywords

Installation

Install via npm:

$ npm i node-net

Usage

Hello World

const server = require('node-net')
const app = new server()

// response
app.use(async function() {
  this.body = 'Hello World';
});
 
app.listen(3000);

Middleware

app.use(async function (next) {
    console.log(this.url)
    setTimeout(() => {
        assert(this, app, 'should equal')
    })
    await next()
    console.log('m1')
}, function () {
    console.log('end')
})

Error Handler

app.on('error', (err) => {
    throw new Error(err)
    console.log('err: ' + err)
})

Cookies

app.keys = '' // Use Keygrip
this.cookies.set( name, [ value ], [ options ] )
this.cookies.get( name, [ options ] )

Authors

Yanglin (i@yangl.in)

License

Copyright (c) 2018 Yanglin

Released under the MIT license

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago