0.1.2 • Published 7 months ago

@response/html v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 months ago

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 code
  • headers: object - The custom headers
  • data: string - The HTML data
0.1.2

7 months ago

0.1.1

4 years ago

0.1.0

4 years ago