0.1.2 • Published 7 months ago
@response/string v0.1.2
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