Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/connect-history-api-fallback

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/connect-history-api-fallback

TypeScript definitions for connect-history-api-fallback

  • 1.5.4
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.8M
increased by7.56%
Maintainers
1
Weekly downloads
 
Created

What is @types/connect-history-api-fallback?

@types/connect-history-api-fallback provides TypeScript type definitions for the connect-history-api-fallback middleware. This middleware is used in single-page applications (SPAs) to handle the fallback for HTML5 history API, ensuring that the application can handle deep links and refreshes properly by redirecting all non-API requests to the index.html file.

What are @types/connect-history-api-fallback's main functionalities?

Basic Usage

This code demonstrates the basic usage of the connect-history-api-fallback middleware in an Express application. It sets up the middleware to handle fallback for HTML5 history API and serves static files from the 'public' directory.

const history = require('connect-history-api-fallback');
const express = require('express');
const app = express();

app.use(history());
app.use(express.static('public'));

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Custom Options

This code demonstrates how to use the connect-history-api-fallback middleware with custom options. The 'index' option specifies the fallback file, and the 'verbose' option enables logging of the rewrite process.

const history = require('connect-history-api-fallback');
const express = require('express');
const app = express();

const options = {
  index: '/index.html',
  verbose: true
};

app.use(history(options));
app.use(express.static('public'));

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Other packages similar to @types/connect-history-api-fallback

FAQs

Package last updated on 20 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc