From 71c4c2b08430fb91d783c7925a876dd9a429afab Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Wed, 4 Mar 2015 21:55:12 +0800 Subject: [PATCH] allow custom videoPath in url --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f144b18..a62ebc0 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,7 @@ var createServer = function (e, opts) { var index = opts.index var getType = opts.type || mime.lookup.bind(mime) var filter = opts.filter || truthy + var videoPath = opts.videoPath || '/' var onready = function () { if (typeof index !== 'number') { @@ -86,7 +87,7 @@ var createServer = function (e, opts) { } if (request.headers.origin) response.setHeader('Access-Control-Allow-Origin', request.headers.origin) - if (u.pathname === '/') u.pathname = '/' + index + if (u.pathname === videoPath) u.pathname = '/' + index if (u.pathname === '/favicon.ico') { response.statusCode = 404