# @zazuko/trifid-handle-redirects

> Handle redirects

Latest version **0.1.3** (published 2023-10-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zazuko/trifid-handle-redirects
pnpm add @zazuko/trifid-handle-redirects
yarn add @zazuko/trifid-handle-redirects
bun add @zazuko/trifid-handle-redirects
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2023-10-10 |
| First published | 2022-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 102 |
| Author | Zazuko GmbH |
| Maintainers | zazuko-bot, tpluscode, ludovicm67, ktk |

## Links

- npm: https://www.npmjs.com/package/@zazuko/trifid-handle-redirects
- Repository: https://github.com/zazuko/trifid
- Issues: https://github.com/zazuko/trifid/issues
- npm.io page: https://npm.io/package/@zazuko/trifid-handle-redirects

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [sparql-http-client](https://npm.io/package/sparql-http-client.md) ^2.4.2

## Recent versions

- 0.1.3 (latest) — 2023-10-10
- 0.1.2 — 2023-01-31
- 0.1.1 — 2022-12-12

## README

# trifid-handle-redirects

Redirects handler for [Trifid](https://github.com/zazuko/trifid).

# Usage

Install this Trifid plugin using:

```sh
npm install @zazuko/trifid-handle-redirects
```

Add to the trifid-configuration file

```yaml
middlewares:
  # […]
  arbitrary-name:
    module: "@zazuko/trifid-handle-redirects"
```

## Defaults

### Redirect description

This handler expects redirects to be described in the following way:

```turtle
@prefix http: <http://www.w3.org/2011/http#> .
@prefix ex:   <http://some/resource/> .

ex:redirect
    a               http:GetRequest ;
    http:response   [ a                 http:Response ;
                      http:responseCode http:301 ;
                      http:location     ex:redirectedTo ; ] ;
    http:requestURI ex:exampleResource .
```

In this example, a redirect is declared for the resource `ex:exampleResource`, to the location `ex:redirectedTo`.

### Default query

```sparql
PREFIX http:   <http://www.w3.org/2011/http#>
SELECT ?location ?code WHERE {
    GRAPH ?g {
        ?request a http:GetRequest ;
        http:response [
        a http:Response ;
        http:responseCode ?code ;
        http:location ?location
        ] ;
        http:requestURI <CURRENT_RESOURCE>
    }
} LIMIT 1
```

---
_Source: https://npm.io/package/@zazuko/trifid-handle-redirects · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
