@response/string
v0.1.2
Published
A class representing a raw response backed by a string.
Downloads
55
Readme
String Response
A class representing a raw response backed by a string.
Installation
npm install @response/string
Usage
const string = require('@response/string')
const http = require('http')
http.createServer((req, res) => {
// Status 200, type text/plain
string('Hello,World').write(res)
// Status 200, type text/plain
string(200, 'Hello,World').write(res)
// Status 200, type text/csv
string(200, 'Hello,World', { 'Content-Type': 'text/csv' }).write(res)
})
Mutable Properties
statusCode: number
- The status codeheaders: object
- The custom headersdata: string
- The raw data