File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ if (argv.h || argv.help) {
18
18
'usage: http-server [path] [options]' ,
19
19
'' ,
20
20
'options:' ,
21
+ ' -b Base path [/]' ,
21
22
' -p Port to use [8080]' ,
22
23
' -a Address to use [0.0.0.0]' ,
23
24
' -d Show directory listings [true]' ,
94
95
95
96
function listen ( port ) {
96
97
var options = {
98
+ baseDir : argv . b ,
97
99
root : argv . _ [ 0 ] ,
98
100
cache : argv . c ,
99
101
showDir : argv . d ,
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ function HttpServer(options) {
43
43
44
44
this . headers = options . headers || { } ;
45
45
46
+ this . baseDir = options . baseDir === undefined ? '/' : options . baseDir ;
46
47
this . cache = options . cache === undefined ? 3600 : options . cache ; // in seconds.
47
48
this . showDir = options . showDir !== 'false' ;
48
49
this . autoIndex = options . autoIndex !== 'false' ;
@@ -94,6 +95,7 @@ function HttpServer(options) {
94
95
}
95
96
96
97
before . push ( ecstatic ( {
98
+ baseDir : this . baseDir ,
97
99
root : this . root ,
98
100
cache : this . cache ,
99
101
showDir : this . showDir ,
You can’t perform that action at this time.
0 commit comments