Skip to content

Commit d6aa31e

Browse files
committed
Merge pull request nasa#893 from nasa/open885
nasa#885 added command line option --directory -D to specify base directory
2 parents 3efaa3b + 1cdeccc commit d6aa31e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
// Defaults
2121
options.port = options.port || options.p || 8080;
22+
options.directory = options.directory || options.D || '.';
2223
['include', 'exclude', 'i', 'x'].forEach(function (opt) {
2324
options[opt] = options[opt] || [];
2425
// Make sure includes/excludes always end up as arrays
@@ -36,6 +37,7 @@
3637
console.log(" --port, -p <number> Specify port.");
3738
console.log(" --include, -i <bundle> Include the specified bundle.");
3839
console.log(" --exclude, -x <bundle> Exclude the specified bundle.");
40+
console.log(" --directory, -D <bundle> Serve files from specified directory.");
3941
console.log("");
4042
process.exit(0);
4143
}
@@ -71,7 +73,7 @@
7173
});
7274

7375
// Expose everything else as static files
74-
app.use(express['static']('.'));
76+
app.use(express['static'](options.directory));
7577

7678
// Finally, open the HTTP server
7779
app.listen(options.port);

0 commit comments

Comments
 (0)