1.0.5 • Published 4 years ago

express-teapot v1.0.5

Weekly downloads
3
License
ISC
Repository
-
Last release
4 years ago

express-teapot

An express middleware to send HTTP 418 Status codes.

Installation

Using npm:

$ npm i express-teapot

In Node.js:

// Import in app.ts
import teapot from 'express-teapot';

// Use as middleware
app.use(teapot());

// Use as middleware with route
app.use(teapot('/IWantTea'));

// Use as middleware with configuration
app.use(teapot({
    route: '/teapot',
    webpage: `
    <html>
        <head>
            <title>Some Tea for you</title>
        </head>
        <body>
            <h1>HTTP Error 418 - I'm a teapot</h1>
        </body>
    </html>`
}));

API

Teapot

Initializing of the teapot middleware. Leave empty to use the default route and default webpage.

teapot(): express.RequestHandler
teapot(route: string): express.RequestHandler
teapot(config: Configuration): express.RequestHandler

Configuration

PropertyDefaultDescription
route'/coffee'The route the requesthandler is listening to.
webpageFilecontent of ../static/index.htmlThe webpage that is displayed to the user when visiting the HTTP 418 error page.

Teapot Image

Images by Teapot Vectors by Vecteezy

1.0.2

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago