@response/html
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @response/html

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

1.96 kB

Total Files

4

Last publish

Collaborators

  • linusu