Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 11, 2024 via pnpm

connect-history-api-fallback 2.0.0

Provides a fallback for non-existing directories so that the HTML 5 history API can be used.
Package summary
Share
0
issues
1
license
1
MIT
Package created
18 May 2013
Version published
27 Jun 2022
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
connect-history-api-fallback@2.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of connect-history-api-fallback 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does connect-history-api-fallback do?

The connect-history-api-fallback is a handy middleware used to proxy requests through a specified index page. Its primary utility is for handling Single Page Applications (SPAs) that make use of the HTML5 History API. It provides a fallback mechanism for non-existing directories, hence enabling the usage of the HTML 5 History API. This prevents issues where the user refreshes the page or directly accesses a page other than the index.html, which would usually result in a 404 Not Found error. Therefore, it changes the requested location to a specified index whenever a GET or HEAD request that accepts text/html is made and is neither a direct file request nor matches a pattern specified in options.rewrites.

How do you use connect-history-api-fallback?

To use connect-history-api-fallback, it needs to be installed from NPM and added as a middleware to the application. Here is a simple usage example:

// Step 1: Install via NPM
npm install --save connect-history-api-fallback

// Step 2: Import the library
var history = require('connect-history-api-fallback');

// Step 3: Add the middleware to your application
var connect = require('connect');

var app = connect()
  .use(history())
  .listen(3000);

It can also be incorporated into an express application as follows:

var express = require('express');

var app = express();
app.use(history());

Additionally, options can be passed to the library to override the default settings. These include the index, rewrites, verbosity, htmlAcceptHeaders, and disabling the dot rule.

Where are the connect-history-api-fallback docs?

The documentation for connect-history-api-fallback can be found in the README file of its GitHub repository, which is located at https://github.com/bripkens/connect-history-api-fallback. The documentation provides a comprehensive overview of the library, outlining its usage, ways to customize it with options, and how to include it in your application. It's a useful resource for anyone looking to leverage this package in their web applications.