{"_id":"node-static-alias","_rev":"19-4730cc38713eda763bfad8ba36874755","name":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","dist-tags":{"latest":"1.1.2"},"versions":{"0.1.0":{"name":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","version":"0.1.0","homepage":"https://github.com/anseki/node-static-alias","author":{"name":"anseki"},"repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"licenses":[{"type":"MIT","url":"https://github.com/anseki/node-static-alias/blob/master/LICENSE-MIT"}],"main":"./lib/node-static-alias.js","engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"keywords":["http","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"_id":"node-static-alias@0.1.0","dist":{"shasum":"2c4419655178804c5c12cb542c03ba8ed58bf331","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-0.1.0.tgz","integrity":"sha512-kWCc+ciLBLRTuK0krMAaoteFdUGSedxETX2XGiiUijpwAY9QxU7ULxhyf2jl9LyC6O9OQgVU/PdRJtHh+sWzFA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0eL3Bym8FJ1udtELScBC1Hi82phbDtBdMnwB8xXuW+gIhAPMGLZrIV+tr2id2BwCK8H80ESzAWDRa/wTxu7rkKcFw"}]},"_resolved":"c:\\DOCUME~1\\Admin\\LOCALS~1\\Temp\\npm-2208-SRUwOQH9\\1388329065687-0.3270332692191005\\tmp.tgz","_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"directories":{}},"0.1.1":{"name":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","version":"0.1.1","homepage":"https://github.com/anseki/node-static-alias","author":{"name":"anseki"},"repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"licenses":[{"type":"MIT","url":"https://github.com/anseki/node-static-alias/blob/master/LICENSE-MIT"}],"main":"./lib/node-static-alias.js","engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"_id":"node-static-alias@0.1.1","dist":{"shasum":"610e040e28311d9d82f660e94bdf38dfe7922ff0","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-0.1.1.tgz","integrity":"sha512-u69G9ILpwz+UmtR4TLC0GQE3UQkuH2IG8RcVW1SWQ1j9SjMoezQTszsZX1nIWlhqLoRxbjCocJklCyAZSn75gA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAi61O2K+8lxyCzzHDgnWdFrPTAPt9ph+UfAh+/O0O1sAiBpeNojqgyW3ksdJmFN4LXOFrREHLnfkGBxrgfhTKseFQ=="}]},"_resolved":"c:\\DOCUME~1\\Admin\\LOCALS~1\\Temp\\npm-2456-MUj4KmL-\\1403826863811-0.8709786210674793\\tmp.tgz","_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"directories":{}},"0.1.2":{"name":"node-static-alias","version":"0.1.2","title":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"main":"./lib/node-static-alias.js","engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"homepage":"https://github.com/anseki/node-static-alias","repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"licenses":"MIT","author":{"name":"anseki","url":"https://github.com/anseki"},"gitHead":"6d12fe11b0e7b335fd62decf3c6e681707f02748","_id":"node-static-alias@0.1.2","scripts":{},"_shasum":"b86956b92dd3f4291d35bd63af536b32224c3c04","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"dist":{"shasum":"b86956b92dd3f4291d35bd63af536b32224c3c04","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-0.1.2.tgz","integrity":"sha512-VWbB5aHitYaXG1LcHzrKfqbP/K/+QKhRHjlBBnjB8blXQzrfHWFsKXUu5VVidkDrIyD4ep5eEhmfQ3RPwcI60Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICCi1r8v9ZPmzpAb3vhnJA6ut5ALQ/K54q18dZP8v5mSAiBGgqH/PUgxu9AXCtTqzs8YdVYyNz8L4czoXWTGDIx/Vw=="}]},"directories":{}},"0.1.3":{"name":"node-static-alias","version":"0.1.3","title":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"main":"./lib/node-static-alias.js","engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"homepage":"https://github.com/anseki/node-static-alias","repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"license":"MIT","author":{"name":"anseki","url":"https://github.com/anseki"},"gitHead":"d7b484009d53140b4f56a5f3df14d2de180a9aae","_id":"node-static-alias@0.1.3","scripts":{},"_shasum":"6088c0dfd06984d0e37bdf19ce489c4e3399997a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"dist":{"shasum":"6088c0dfd06984d0e37bdf19ce489c4e3399997a","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-0.1.3.tgz","integrity":"sha512-QNTPX/pNUoqklCyUzajomhwHfDf/Y3EsV625b5j7Z3L/Jms+GpJ8QLzJtPPb2hW89Hlytittl7otLE6ldSIcOw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBJw2F0cbzlGyjCJQ/iJp6pu/qPubGkM0r9V24ZRhUGmAiAC9DpcWIkHY0DcOZinDgCQ1xFccwNES87rvhyrF3X6hg=="}]},"directories":{}},"1.0.0":{"name":"node-static-alias","version":"1.0.0","title":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"main":"./lib/node-static-alias.js","engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"homepage":"https://github.com/anseki/node-static-alias","repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"license":"MIT","author":{"name":"anseki","url":"https://github.com/anseki"},"gitHead":"1aaae30213250d82ddb57f187db763313cc82c05","_id":"node-static-alias@1.0.0","scripts":{},"_shasum":"b12c63bbae51801c2619ded347976badd130733e","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"dist":{"shasum":"b12c63bbae51801c2619ded347976badd130733e","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-1.0.0.tgz","integrity":"sha512-Bzow3wjjC7QJtPTCkU4je/cOxApJMFYTlbaHz4wnawiU1toFFt+ocg0Td42EzIbFVXl7DqAFoJwdYQKNfb/pdA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICUANNskiacag94ESJYfPPEnVUHMNmZEn9nOmQ8vZ63SAiBQS4jwjWglMi5Q2OMsb6h1Vpm7JpK7zrGQxNHBlyeVNQ=="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/node-static-alias-1.0.0.tgz_1486120881273_0.7941532877739519"},"directories":{}},"1.1.0":{"name":"node-static-alias","version":"1.1.0","title":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"main":"./lib/node-static-alias.js","files":["lib/!(.eslintrc.json)"],"engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"homepage":"https://github.com/anseki/node-static-alias","repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"license":"MIT","author":{"name":"anseki","url":"https://github.com/anseki"},"gitHead":"8432df11b60e0de67cbc7b7224470968c6729500","_id":"node-static-alias@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"dist":{"integrity":"sha512-xQUXqHhKJBJjXaicHil7jMGjdSJHcbFhg2PtRYoWr64IfqNX5DnnPJnOcdubOyVj+7sYamEhDW4pnT6AQcoQmg==","shasum":"1cde7d7a44dd88713c9487cefa186418b35d3c24","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-1.1.0.tgz","fileCount":4,"unpackedSize":17234,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCOjUCRA9TVsSAnZWagAAoDgP/3XgF+IospR4Rf9+9fsj\nSEsZfHHlAVLo9cTV5swBnsiaKG/1Z63OzYGYopG5UZ1xhIeZpSovV4cfFnok\nhUBnoE695tDyJYMF3FiIvjVXrW6TjP0I6mmItvtbCrlqGAzJ8AM2ttcJTEkG\nOxR0Kdee43/ce1xDGLjzOQMuWXdBm9RHgk3q3lNjtJaomiZVf+sKdmdyYMiA\ngOPOqS8Py6w59V5Fq7uJdXiwWQD1xVjlAhoXSwC4xdaByL8VM5xInUlLJ6+P\n/EqJXN9euW8y8iqSxVqPpdIKfflJhqrEj9KEauM9WOvNm3w0X5nAE2ZVmYdX\nBqWJGrWSL9HPyiaW+eR7Vm59rtW9ebYCraNIS3bxQCHDZYqEFj93y+H0bIkt\n+BoGg5k33JU0waXoFteE8CZ/vspRYA6CQ5xZyLhGff1CKTuvaZllcNqkbs+D\nNIUvkhHM1u+pdgOM3nlSKz6RXZIFavbGUjRRZm8Q3en+mqPANDqy3SAumLc6\nVdbjMsF483zBLiLJPL5PTSpvZqnZgcIgVFuwI1VIJ1uqK0plbVKRARfFmw5Z\nxGxK5G+x/Mhmtr98XS/SGnzB5uTQSStM9IveG/S7U69/7+UHbVK3C/RgiB+X\n/80ZqjiS5e+WEbN6wqkquJC3NBc3918Z9b3tGuUl2WSjZD0AySlLAeta2b0s\nqPe7\r\n=nKmL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBV5tRObqJFVEN/ms9JIGhWjNOiMtD1aPmcpMy5Nkc6gAiEAu3XEOohgB/0S57xqCLojlPxBOEmTsgAJvHQ9g7EbuA8="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-static-alias_1.1.0_1527310546872_0.2891245164437579"},"_hasShrinkwrap":false},"1.1.1":{"name":"node-static-alias","version":"1.1.1","title":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"main":"./lib/node-static-alias.js","files":["lib/!(.eslintrc.json)","example/!(.eslintrc.json)"],"engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"homepage":"https://github.com/anseki/node-static-alias","repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"license":"MIT","author":{"name":"anseki","url":"https://github.com/anseki"},"gitHead":"b0020219820a61094f34b545795ff5d9c15cdeef","_id":"node-static-alias@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"dist":{"integrity":"sha512-5buGkrD3TFQ/l7rhql5oe+xlI/atv/i0xp+14RucRuT5w3qGkixeyIJb9Hq9Sed0rb/QqDrne4DrLXfXf4sGbA==","shasum":"38e70cf96c3014dabae9803e9da432de03878a49","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-1.1.1.tgz","fileCount":11,"unpackedSize":24822,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCO3SCRA9TVsSAnZWagAAKjUQAJUizCLK1BOfQihdbFll\nTIHFEgsEltGnrlRWnLesugDVxO/fps2IhMo4OAI+gsfjzvslyuh05YL8uxpw\n8j7K7PBVpc9Q+4u4HKqY4OPJz/Ge10FRGI1ta5zl6xh406HOzntuk9md6yhJ\ndb02FKxwNC1BjHHbRE/zaRkCvBt0W00/Da9tY65UbmMUN90z59U4j4ocPawP\nQX0f+22REQnlNb70SI/2Ztq2FERXndPtwvr2KaY7cXvtSjBGWDVK5ncvXZw9\nhoviGh1J9qjVj3RAqw024OkIB/dXCbiixkf0C9dr0bByxLhdTkRJddlbbWK9\n6G3GgkxIly2Zy2o1ud8lYbQIa8ni22r/aic0k+aPrSraZOldU2wtup9F9ixJ\nmyWfSSNBpLHX2GAZgUkjEEqo0PuNzEGisss4NXTwseBkIu1jP6uwSjXA6PTV\nago6rjIt9wGlTAWKWcEsk3Nu56PuSiXpT+vGahwNXMEPoN2nf8RpXX3Uhzw7\noWPkcbIGiDU/Wv1qO+nbZh73eRb5TXwAhVSOjDqwF4URXERt/tKBfmOSliHi\nu9XvVbuMLF1LOWq5TyNjFLexoVlt5qiyA7Qnur52zYryNidA99MVG7kQNEnS\n+mu0Hk/G5ODnI54/fscAXvAKMKqhuvDY7v61WqRoALQ/O/B+wlxKw6J2PMHg\njyGd\r\n=p6oI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbyd2wNCcrjODJhRtwDORu1ghX4+DLr8iYrpqpcFCe6AIgJJVW8r1X7A0LyVoMEj4ktrdyA+mk5R4zdwTtdcoX3V0="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-static-alias_1.1.1_1527311826282_0.3439482252625554"},"_hasShrinkwrap":false},"1.1.2":{"name":"node-static-alias","version":"1.1.2","title":"node-static-alias","description":"Serve static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"main":"./lib/node-static-alias.js","files":["lib/!(.eslintrc.json)","example/!(.eslintrc.json)","ss.png"],"engines":{"node":">= 0.8.0"},"dependencies":{"node-static":"~0.7.2"},"homepage":"https://github.com/anseki/node-static-alias","repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"license":"MIT","author":{"name":"anseki","url":"https://github.com/anseki"},"gitHead":"550e6d8664b275a039e688fca306500e1602a523","_id":"node-static-alias@1.1.2","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"anseki","email":"AnSeki.aff@gmail.com"},"maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"dist":{"integrity":"sha512-7bf68LiGhBCYodZT+8ksClWnzjTH1ac0BhXdAJjK7DliktuPaNMbTUnePkwWklLEKDUuMPaL2nVQvhHuCMG0Og==","shasum":"7ba467e188dc7182ba42815a939a0b149c5d4302","tarball":"https://registry.npmjs.org/node-static-alias/-/node-static-alias-1.1.2.tgz","fileCount":12,"unpackedSize":28130,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbC2vkCRA9TVsSAnZWagAAsUAP/1cIExlcBhpOgcq1rZ1H\n8rkCkH/LTJp/F1CwtJosJm5iIcLe6LuxL6nAs2K1K8NuJ3nQAzwepjPCAqik\nn4h3FsbyTjeY1Hon92i1aGjMvVSBXHb9VzsKMOqsYhtyBJDDeDBs5RIpOuLA\nKxN8+txvWHG8QJI/uQnJt2v6YV4QXvnPDGjtyy5OtasZFAmX0fzjnGaoaGfD\nsm2/1jvVgWKpsXLscbomH2ujOtjqFw9HxWeDkTU19RaD0q10xY1jpCqqL7qQ\nIq9WPZrPgZ23r1hovTdJBYe26phGkiDMLqBXt7VG73OqmgXyYIsM4IUu7xCf\nr7dWiTLkcTZia6JlDR2hdEpoadpO1p0nXedhxZg7vQiw1qKxqLD7X6v0iZ5S\nJ9zRYVmd21loIqNz/+2/u2BYfZDrkCKOkYuwPZ+C7XnzORUp8VDxiflORhD7\nw27fNG9N/xREaB9k1MZsqD0yk0C8sOCW/YEdjldNlemE5uMRZMziriTarUaO\nLiSBpLAtGc8XaeFsrE6z9M2fZXYDBWe8NF6D2cjGXGtchqaZ12+RQ5NSxS3D\njG4zPd0y76G3aY0ftWR5x5+r6WkuCdWUSB/y0GCvZj4JD7dLK1QIRzgxaGdO\nUMfwm//PdjseNXjNH+Oejee/JA8Y92Lh0Uwxlp+6N40FO3rCPSqEbxk/vSof\nkx2G\r\n=WXgw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAxq1gTMRRaobGruVRbH46Ij3rNq7utQ78gZAToBrJIaAiBk119cKja7M3WKRi4pa23L/MZ1rO9Ep5tIw7U9ks9moQ=="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-static-alias_1.1.2_1527475170944_0.3012294345011437"},"_hasShrinkwrap":false}},"readme":"# node-static-alias\n\n[![npm](https://img.shields.io/npm/v/node-static-alias.svg)](https://www.npmjs.com/package/node-static-alias) [![GitHub issues](https://img.shields.io/github/issues/anseki/node-static-alias.svg)](https://github.com/anseki/node-static-alias/issues) [![David](https://img.shields.io/david/anseki/node-static-alias.svg)](package.json) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)\n\nServe static file which is not requested file. (e.g. `file.min.js` is requested, serve `file.js`)  \nnode-static-alias wraps (inherits) the useful module [node-static](https://github.com/cloudhead/node-static/), and this adds the [`alias`](#alias) option to that.  \nThis works like the [Alias](http://httpd.apache.org/docs/2.4/mod/mod_alias.html) mapping or the [mod_rewrite\n](http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html) of Apache. It looks like [DirectoryIndex](http://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex) too. And this can check the file exists or not.\n\n+ Serve `file.js` instead of `file.min.js` which is not made yet, in the test phase.\n+ Serve the outside files of the document-root which are shared by multiple web sites in one machine.\n+ Serve the default page which is not `index.html` when *`/` is requested.\n\n## Synopsis\n\n```js\nvar staticAlias = require('node-static-alias');\n\n// Document-Root: './public' directory\nvar fileServer = new staticAlias.Server('./public', {\n  alias: {\n    match: '/path/to/file.min.js',\n    serve: '/path/to/file.js'\n  }\n});\n\nrequire('http').createServer(function(request, response) {\n  request.addListener('end', function() {\n    fileServer.serve(request, response);\n  }).resume();\n}).listen(8080);\n```\n\n## Usage\n\nThe [`alias`](#alias) option is added to the node-static via using `require('node-static-alias')` instead of `require('node-static')`. See [node-static](https://github.com/cloudhead/node-static/) to use it.\n\n### `alias`\n\nThe `alias` included in the constructor options is an Alias-Rule Object, or an array which includes multiple Alias-Rule Objects.\n\n```js\n  alias: {\n    match: /file\\.min\\.(?:js|css)$/,\n    serve: '/path/to/file.<% suffix %>'\n  }\n```\n\nOr\n\n```js\n  alias: [\n    {\n      match: '/path/to/file.min.js',\n      serve: '/path/to/file.js'\n    },\n    {\n      match: 'suffix=png',\n      serve: '../outer/<% fileName %>',\n      allowOutside: true\n    }\n  ]\n```\n\nThe Alias-Rule Object can have following properties.\n\n### `match`\n\n**Type:** string, RegExp, function or Array\n\nSpecify one of below or an Array which includes multiple things of those.  \nIf one or more things match, the [`serve`](#serve) is parsed. If anything doesn't match, it goes to next an Alias-Rule. If all Alias-Rules don't match, it tries to serve the requested file.\n\n+ **string:**  \nIf the requested path is equal to this string, it's matched.  \nOr, this can be `parameter=value` format (e.g. `suffix=png`). See [Parameters](#parameters). If the `value` is equal to the specified parameter, it's matched.\n\n```js\n  alias: [\n    {\n      match: '/path/to/file.min.js',\n      serve: '/path/to/file.js'\n    },\n    // Image files are not made yet.\n    {\n      match: 'suffix=png',\n      serve: '/path/to/dummy.png'\n    }\n  ]\n```\n\n+ **RegExp:**  \nThe RegExp which tests the requested path.\n\n```js\n  // These image files are not made yet.\n  alias: {\n    match: /\\/(?:foo|bar)\\.png$/,\n    serve: '/path/to/dummy.png'\n  }\n```\n\n+ **function:**  \nThe function which returns `true` or `false`.\nThe Object which has parameters is passed to this function. See [Parameters](#parameters). Also, current `request` instance and `response` instance are passed.  \nIn the function, `this` refers to own instance.\n\n```js\n  // Kick direct access from outside web site.\n  alias: {\n    match: function(params, request, response) {\n      console.log(request.url + ' was requested, in the path ' + this.root);\n      return params.suffix === 'jpg' &&\n        params.referer.indexOf('http://mysite.com/') !== 0;\n    },\n    serve: '/path/to/denial.jpg'\n  }\n```\n\n### `serve`\n\n**Type:** string, function or Array\n\nSpecify one of below or an Array which includes multiple things of those.  \nBy default, the first file which exists is chosen to try to serve. See [force](#force). If anything doesn't exist, it goes to next an Alias-Rule. If all files of Alias-Rules don't exist, it tries to serve the requested file.\n\n+ **string:**  \nThe absolute path or relative path from the document-root of the file to serve.  \nThis can include parameters like `<% parameter %>`. See [Parameters](#parameters).\n\n```js\n  // directoryIndex isn't index.html\n  alias: {\n    match: /\\/$/,\n    serve: '<% absPath %>/default.html'\n  }\n```\n\n*NOTE:* If the first character of this string is `/` (it might be parameter), this string is absolute path. This `/` doesn't point the document-root. It is the root of the local filesystem. If you want the relative path from the document-root, don't specify leading `/`, or add `.` to left of leading `/`.\n\n+ **function:**  \nThe function which returns the absolute path or relative path from the document-root of the file to serve.  \nThe Object which has parameters is passed to this function. See [Parameters](#parameters). Also, current `request` instance and `response` instance are passed.  \nIn the function, `this` refers to own instance.\n\n```js\n  // Minified files are not made yet.\n  alias: {\n    match: /\\.min\\.(?:js|css)$/,\n    serve: function(params, request, response) {\n      response.setHeader('X-serve-from', this.root);\n      return params.absDir + '/' +\n        params.basename.replace(/\\.min$/, '.') + params.suffix;\n    }\n  }\n```\n\n```js\n  // Compile unwatched SASS now.\n  alias: {\n    match: 'suffix=css',\n    serve: function(params) {\n      require('exec-sync')('sass ' +\n        params.absDir + '/' + params.basename + '.scss:' + params.absPath);\n      return params.absPath;\n    }\n  }\n```\n\n### `force`\n\n**Type:** boolean\n\nIf `true` is specified, the first file in the [`serve`](#serve) is chosen to try to serve without checking it's existing or not. And if it doesn't exist, a 404 error occurs. Default is `false`.  \nThis is used to prevent another file from being chosen unintentionally.\n\n### `allowOutside`\n\nIf `true` is specified, serving the outside files of the document-root is allowed. Default is `false`.\n\n```js\n  // Shared files.\n  alias: {\n    match: /^\\/common_lib/,\n    serve: '/path/to/lib/<% fileName %>',\n    allowOutside: true\n  }\n```\n\n*NOTE:* If you specify `true` in the public server, you should specify the absolute path to the [`serve`](#serve). Otherwise the user might access to the file that must be hidden from them.\n\n## Parameters\n\nThe string `parameter=value` can be specified to the [`match`](#match), and the string `<% parameter %>` can be specified to the [`serve`](#serve).  \nAnd also, the Object which has parameters is passed to function which specified to the [`match`](#match) and the [`serve`](#serve).  \nThese parameters are below.\n\n+ `reqUrl`  \nThe URL which is requested by the user. e.g. `/path/to/file.ext?key1=value1&key2=value2`\n+ `reqPath`  \nThe path which is requested by the user. e.g. `/path/to/file.ext`  \nThis might be a directory. e.g. `/`\n+ `reqDir`  \nThe path to a directory which is part of `reqPath`. e.g. `/path/to`\n+ `absPath`  \nThe absolute path to a requested file. e.g. `/var/www/public/path/to/file.ext`\n+ `absDir`  \nThe absolute path to a directory which is part of `absPath`. e.g. `/var/www/public/path/to`\n+ `fileName`  \nThe file name of a requested file. e.g. `file.ext`  \nThis might be a directory name e.g. `to`  \nIf the document-root is requested, this is empty string.\n+ `basename`  \nThe part of the file name except file-suffix. (`.` isn't included) e.g. `file`\n+ `suffix`  \nThe part of the file name which is extracted file-suffix. (`.` isn't included) e.g. `ext`\n+ `reqQuery`  \nThe URL query string which is part of `reqUrl`. e.g. `key1=value1&key2=value2`\n+ Parsed query string  \nPairs of a key beginning with a `query_` and a value. e.g. `query_key1`: `value1`, `query_key2`: `value2` from `reqQuery` above  \nAn array is extracted and each key is given `[INDEX]`. e.g. `query_key[0]`: `value1`, `query_key[1]`: `value2` from `key=value1&key=value2`\n+ Request Headers  \nThe HTTP Request Headers from the client. These are lower-cased. e.g. `referer`, `user-agent`, etc.\n\n## Logging\n\nThe `logger` included in constructor options is a Logger instance of the standard Logging Library (e.g. [log4js](https://github.com/nomiddlename/log4js-node)) which has `info` method or `log` method.\n\n```js\nvar log4js = require('log4js');\nvar logger = log4js.getLogger('node-static-alias');\nlogger.setLevel(log4js.levels.INFO);\n\nvar fileServer = new staticAlias.Server('./public' {\n  alias: { ... },\n  logger: logger\n});\n```\n\nYou can specify a simple Object which has `info` method or `log` method (e.g. `console` or `util`).  \nMost easy:\n\n```js\nvar fileServer = new staticAlias.Server('./public' {\n  alias: { ... },\n  logger: console\n  //logger: require('util') // Add timestamp\n});\n```\n\nAdd project name: (But, you probably use your favorite library.)\n\n```js\nvar fileServer = new staticAlias.Server('./public' {\n  alias: { ... },\n  logger: {log: function() {\n    var util = require('util');\n    console.log('[node-static-alias] ' +  util.format.apply(util, arguments));\n  }}\n});\n```\n\nLog message example:\n\n```console\n(/) Requested: \"/var/public\"\n(/file.min.css) Requested: \"/var/public/file.min.css\"\n(/file.min.css) For Serve: \"/var/public/file.css\" alias[3] match[1] serve[0]\n(/file.min.js) Requested: \"/var/public/file.min.js\"\n(/file.min.js) For Serve: \"/var/public/file.js\" alias[2] match[0] serve[1]\n```\n\nThe `(path)` is the path which is requested by the user. The `[number]` means an index of an Array.\n\n## Files list in the Directory\n\nThis example generates a list of files and directories in requested directory when the user accessed the directory. This works like the [mod_autoindex](http://httpd.apache.org/docs/2.4/mod/mod_autoindex.html) of Apache.\n\nThat looks like:  \n![ss](ss.png)\n\nThe [statsFilelist](https://www.npmjs.com/package/stats-filelist) is required.\n\n```\nnpm install stats-filelist\n```\n\nLoad that and some core modules.\n\n```js\nvar filelist = require('stats-filelist'),\n  path = require('path'),\n  fs = require('fs');\n```\n\nSpecify for `alias`:\n\n```js\nalias: {\n  match: function(params) {\n    try {\n      return fs.statSync(params.absPath).isDirectory();\n    } catch (error) {\n      return false; // Ignore \"Not found\" etc.\n    }\n  },\n  serve: function(params) {\n    var indexPath = path.join(params.absPath, '.index.html');\n    fs.writeFileSync(indexPath,\n      '<html><body><ul>' +\n      filelist.getSync(params.absPath, /^(?!.*[/\\\\]\\.index\\.html$).+$/, false)\n        .map(function(stat) {\n          var relPath = stat.name + (stat.isDirectory() ? '/' : '');\n          return '<li><a href=\"' + relPath + '\">' + relPath + '</a></li>';\n        }).join('') +\n      '</ul></body></html>');\n    return indexPath;\n  }\n}\n```\n","maintainers":[{"name":"anseki","email":"AnSeki.aff@gmail.com"}],"time":{"modified":"2022-06-21T22:09:34.072Z","created":"2013-12-29T14:57:10.065Z","0.1.0":"2013-12-29T14:57:11.309Z","0.1.1":"2014-06-26T23:53:43.905Z","0.1.2":"2014-10-23T20:28:56.046Z","0.1.3":"2015-05-28T06:04:55.312Z","1.0.0":"2017-02-03T11:21:21.521Z","1.1.0":"2018-05-26T04:55:46.934Z","1.1.1":"2018-05-26T05:17:06.407Z","1.1.2":"2018-05-28T02:39:31.141Z"},"author":{"name":"anseki","url":"https://github.com/anseki"},"repository":{"type":"git","url":"git://github.com/anseki/node-static-alias.git"},"homepage":"https://github.com/anseki/node-static-alias","keywords":["http","httpd","test","static","file","server","alias","mod_rewrite","directoryindex","min","log"],"bugs":{"url":"https://github.com/anseki/node-static-alias/issues"},"readmeFilename":"README.md","users":{"azaslavsky":true},"license":"MIT"}