# write-response

> Send a JSON or a text response to an http response object

Latest version **2.0.2** (published 2023-08-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install write-response
pnpm add write-response
yarn add write-response
bun add write-response
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2023-08-01 |
| First published | 2019-11-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mark Wylde |
| Maintainers | markwylde |

## Links

- npm: https://www.npmjs.com/package/write-response
- Repository: https://github.com/markwylde/write-response
- Homepage: https://github.com/markwylde/write-response#readme
- Issues: https://github.com/markwylde/write-response/issues
- npm.io page: https://npm.io/package/write-response

## Recent versions

- 2.0.2 (latest) — 2023-08-01
- 2.0.1 — 2023-06-01
- 2.0.0 — 2023-02-17
- 1.2.3 — 2020-08-13
- 1.2.2 — 2019-11-21
- 1.2.1 — 2019-11-21
- 1.2.0 — 2019-11-21
- 1.1.0 — 2019-11-21
- 1.0.0 — 2019-11-20

## README

# write-response
Send a response to a native node http(s) response object

## Example Usage
### json
```javascript
import writeResponse from 'write-response';
writeResponse(200, { hello: 'all good here' }, response);
```

### text
```javascript
import writeResponse from 'write-response';
writeResponse(200, 'all good here', response);
```

### with headers
```javascript
import writeResponse from 'write-response';
writeResponse(200, '<strong>HELLO</strong>', { 'Content-Type': 'text/html' }, response);
```

## License
This project is licensed under the terms of the MIT license.

---
_Source: https://npm.io/package/write-response · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
