0.4.2 • Published 5 years ago

dragonrend-response v0.4.2

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

Build Status GitHub license

Dragonrend Response

Installation

$ npm install dragonrend-response

Example

const { Dragonrend } = require('dragonrend')
const response = require('dragonrend-response')

const app = new Dragonrend()

response(app, {
  defaultStatus: 201, // default is 200
  defaultContentType: 'text/plain', // default is application/json
  defaultBody: 'Created' // default is empty string
}) // second options argument is not required

// Server will return Response with status 201, contentType 'plain/text' and body 'Hello There'
app.get((ctx) => {
  ctx.response.status = 200
  ctx.response.contentType = 'application/json'
  ctx.response.body = { message: 'Hi There' }
})

app.toServer().listen(8080)

Author

Egor Repnikov - GitHub

License

This project is licensed under the MIT License - see the LICENSE file for details

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago