{
  "manifest": {
    "name": "connect-history-api-fallback",
    "version": "2.0.0",
    "description": "Provides a fallback for non-existing directories so that the HTML 5 history API can be used.",
    "keyswords": [
      "connect",
      "express",
      "html5",
      "history api",
      "fallback",
      "spa"
    ],
    "engines": {
      "node": ">=0.8"
    },
    "main": "lib/index.js",
    "files": [
      "lib"
    ],
    "scripts": {
      "test": "jest && eslint lib/*.js test/*.js"
    },
    "repository": {
      "type": "git",
      "url": "http://github.com/bripkens/connect-history-api-fallback.git"
    },
    "author": {
      "name": "Ben Ripkens",
      "email": "bripkens@gmail.com"
    },
    "contributors": [
      {
        "name": "Craig Myles",
        "email": "cr@igmyles.com",
        "url": "http://www.craigmyles.com"
      }
    ],
    "license": "MIT",
    "devDependencies": {
      "eslint": "^5.16.0",
      "jest": "^24.8.0",
      "sinon": "^7.3.2"
    },
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-connect-history-api-fallback-2.0.0-647264845251a0daf25b97ce87834cace0f5f1c8-integrity/node_modules/connect-history-api-fallback/package.json",
    "readmeFilename": "README.md",
    "readme": "<h1 align=\"center\">connect-history-api-fallback</h1>\n<p align=\"center\">Middleware to proxy requests through a specified index page, useful for Single Page Applications that utilise the HTML5 History API.</p>\n\n<h2>Table of Contents</h2>\n\n<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->\n\n- [Introduction](#introduction)\n- [Usage](#usage)\n- [Options](#options)\n\t- [index](#index)\n\t- [rewrites](#rewrites)\n\t- [verbose](#verbose)\n\t- [htmlAcceptHeaders](#htmlacceptheaders)\n\t- [disableDotRule](#disabledotrule)\n\n<!-- /TOC -->\n\n## Introduction\n\nSingle Page Applications (SPA) typically only utilise one index file that is\naccessible by web browsers: usually `index.html`. Navigation in the application\nis then commonly handled using JavaScript with the help of the\n[HTML5 History API](http://www.w3.org/html/wg/drafts/html/master/single-page.html#the-history-interface).\nThis results in issues when the user hits the refresh button or is directly\naccessing a page other than the landing page, e.g. `/help` or `/help/online`\nas the web server bypasses the index file to locate the file at this location.\nAs your application is a SPA, the web server will fail trying to retrieve the file and return a *404 - Not Found*\nmessage to the user.\n\nThis tiny middleware addresses some of the issues. Specifically, it will change\nthe requested location to the index you specify (default being `/index.html`)\nwhenever there is a request which fulfills the following criteria:\n\n 1. The request is a `GET` or `HEAD` request\n 2. which accepts `text/html`,\n 3. is not a direct file request, i.e. the requested path does not contain a\n    `.` (DOT) character and\n 4. does not match a pattern provided in options.rewrites (see options below)\n\n## Usage\n\nThe middleware is available through NPM and can easily be added.\n\n```\nnpm install --save connect-history-api-fallback\n```\n\nImport the library\n\n```javascript\nvar history = require('connect-history-api-fallback');\n```\n\nNow you only need to add the middleware to your application like so\n\n```javascript\nvar connect = require('connect');\n\nvar app = connect()\n  .use(history())\n  .listen(3000);\n```\n\nOf course you can also use this piece of middleware with express:\n\n```javascript\nvar express = require('express');\n\nvar app = express();\napp.use(history());\n```\n\n## Options\nYou can optionally pass options to the library when obtaining the middleware\n\n```javascript\nvar middleware = history({});\n```\n\n### index\nOverride the index (default `/index.html`). This is the request path that will be used when the middleware identifies that the request path needs to be rewritten.\n\nThis is not the path to a file on disk. Instead it is the HTTP request path. Downstream connect/express middleware is responsible to turn this rewritten HTTP request path into actual responses, e.g. by reading a file from disk.\n\n```javascript\nhistory({\n  index: '/default.html'\n});\n```\n\n### rewrites\nOverride the index when the request url matches a regex pattern. You can either rewrite to a static string or use a function to transform the incoming request.\n\nThe following will rewrite a request that matches the `/\\/soccer/` pattern to `/soccer.html`.\n```javascript\nhistory({\n  rewrites: [\n    { from: /\\/soccer/, to: '/soccer.html'}\n  ]\n});\n```\n\nAlternatively functions can be used to have more control over the rewrite process. For instance, the following listing shows how requests to `/libs/jquery/jquery.1.12.0.min.js` and the like can be routed to `./bower_components/libs/jquery/jquery.1.12.0.min.js`. You can also make use of this if you have an API version in the URL path.\n```javascript\nhistory({\n  rewrites: [\n    {\n      from: /^\\/libs\\/.*$/,\n      to: function(context) {\n        return '/bower_components' + context.parsedUrl.pathname;\n      }\n    }\n  ]\n});\n```\n\nThe function will always be called with a context object that has the following properties:\n\n - **parsedUrl**: Information about the URL as provided by the [URL module's](https://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost) `url.parse`.\n - **match**: An Array of matched results as provided by `String.match(...)`.\n - **request**: The HTTP request object.\n\n\n### verbose\nThis middleware does not log any information by default. If you wish to activate logging, then you can do so via the `verbose` option or by specifying a logger function.\n\n```javascript\nhistory({\n  verbose: true\n});\n```\n\nAlternatively use your own logger\n\n```javascript\nhistory({\n  logger: console.log.bind(console)\n});\n```\n\n### htmlAcceptHeaders\nOverride the default `Accepts:` headers that are queried when matching HTML content requests (Default: `['text/html', '*/*']`).\n\n```javascript\nhistory({\n  htmlAcceptHeaders: ['text/html', 'application/xhtml+xml']\n})\n```\n\n### disableDotRule\nDisables the dot rule mentioned above:\n\n> […] is not a direct file request, i.e. the requested path does not contain a `.` (DOT) character […]\n\n```javascript\nhistory({\n  disableDotRule: true\n})\n```\n",
    "licenseText": "The MIT License\n\nCopyright (c) 2022 Ben Blackmore and contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz",
    "hash": "647264845251a0daf25b97ce87834cace0f5f1c8",
    "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==",
    "registry": "npm",
    "packageName": "connect-history-api-fallback",
    "cacheIntegrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA== sha1-ZHJkhFJRoNryW5fOh4NMrOD18cg="
  },
  "registry": "npm",
  "hash": "647264845251a0daf25b97ce87834cace0f5f1c8"
}