Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/beliven-it/fastify-strip-html

A plugin to automatically strip HTML tags from response payload
https://github.com/beliven-it/fastify-strip-html

fastify html js nodejs security strip tags

Last synced: 26 days ago
JSON representation

A plugin to automatically strip HTML tags from response payload

Awesome Lists containing this project

README

        

# fastify-strip-html

A plugin to automatically strip HTML tags from response payload

![Node.js CI](https://github.com/heply/fastify-strip-html/workflows/Node.js%20CI/badge.svg)

## Install

```bash
$ npm i --save fastify-strip-html
```

## Usage

```js
fastify.register(require('fastify-strip-html'), {
stripFromResponse: true
})

// To test it manually:

console.log(fastify.stripHtml('Hello World'))

// Hello World -> Hello World
```

## Options

| Name | Description |
|-----------------------|------------------------------------------------------------------------|
| `stripFromResponse` | Register a `onSend` hook to strip HTML tags out from a string payload. |

## Test

```bash
$ npm test
```

## Acknowledgements

This project is kindly sponsored by:

[![Beliven](https://assets.beliven.com/brand/logo_pos_color.svg)](https://www.beliven.com)

## License

Licensed under [MIT](./LICENSE)