@zazuko/trifid-handle-redirects

0.1.3 • Public • Published

trifid-handle-redirects

Redirects handler for Trifid.

Usage

Install this Trifid plugin using:

npm install @zazuko/trifid-handle-redirects

Add to the trifid-configuration file

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

Defaults

Redirect description

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

@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

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

Readme

Keywords

none

Package Sidebar

Install

npm i @zazuko/trifid-handle-redirects

Weekly Downloads

45

Version

0.1.3

License

MIT

Unpacked Size

7.18 kB

Total Files

5

Last publish

Collaborators

  • zazuko-bot
  • tpluscode
  • ludovicm67
  • ktk