@universis/routing
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@universis/routing

expressjs routing tools and middlewares

Installation

npm i @universis/routing

Usage

disableCache()

Disables caching by including Cache-Control, Pragma and Expires http headers

import express from 'express';
import { disableCache } from '@universis/routing';

app = express();

app.get('/hello', disableCache(), (req, res) => {
    return res.json({
        message: 'Hello World'
    });
});

remoteClientAccessControl(addresses, proxyAddressForwarding)

Restricts the access to the target based on a collection of remote client addresses.

addresses

An array of strings which represent the collection of remote clients that have access to that resource

proxyAddressForwarding

A boolean which indicates whether the application is running behind a reverse proxy

import express from 'express';
import { remoteClientAccessControl } from '@universis/routing';

app = express();

app.get('/hello', remoteClientAccessControl([
    '127.0.0.1/32'
], false), (req, res) => {
    return res.json({
        message: 'Hello World'
    });
});

Dependencies (2)

Dev Dependencies (19)

Package Sidebar

Install

npm i @universis/routing

Weekly Downloads

0

Version

1.1.1

License

LGPL-3.0-or-later

Unpacked Size

25.9 kB

Total Files

15

Last publish

Collaborators

  • universis