@response/html
v0.1.2
Published
A class representing an HTML text response.
Downloads
5
Readme
HTML Response
A class representing an HTML text response.
Installation
npm install @response/html
Usage
const html = require('@response/html')
const http = require('http')
http.createServer((req, res) => {
// Status 200
html('<p>Hello, World!</p>').write(res)
// Status 500
html(500, '<p>Error</p>').write(res)
// Status 500 & custom headers
html(500, '<p>Error</p>', { 'X-Powered-By': 'Foobar' }).write(res)
})
Mutable Properties
statusCode: number
- The status codeheaders: object
- The custom headersdata: string
- The HTML data