-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback to just serving directory #1
Comments
Currently getting around this by adding |
I don’t want to add a dependency for Express, but there may be a way to do this, maybe as a callback. What about something like: a |
Maybe another package could use docserver and then add more features to it like directory listing. Personally though I think we all want it and adding more features isn't a bad thing. Right now I had to create a serve.js and customize it the way I want. But ideally we could just use docserver in any directory and it would autoindex. I need this all the time ! Small packages are good though. This was the first thing I did:
Works great ! |
@crucialfelix Will that serve a directory listing though even if index.md is defined, overwriting docserver's functionality? My script ended up looking jsut like yours except with reversed |
at first I had use directory afterwards, but it failed to generate a directory at all. docserver would always show 404 I'm not sure if index.md would get override the way I have it a fuller solution would be better. and I am not that fond of the directory display style. so I think another package that makes use of docserver would be useful. or if docserver can easily delegate the directory rendering |
Hello, I agree completely with not adding any dependencies. This module is good at converting markdown files to HTML, so in my opinion (who's asking? ;-) ) it should focus on that and do it well. There are other modules that generate a directory listing, e.g. serve-index: https://github.com/expressjs/serve-index or that define a directory index file, e.g. by mapping To make this work, however, docserver needs to behave like standard middleware, i.e. if it is asked for something other than a markdown file it should pass on the request. You mentioned next() above :-) I need to serve a directory containing a mix of markdown and other files, so what I want to do is quite similar to @crucialfelix :
You could keep the existing behaviour with index.md with a flag, perhaps. Here is how one might render
What do you think? Does it keep the soul of docserver intact whilst making it useful in more situations? |
Can docserver fallback to using
express.directory()
on the current directory if it doesn't find an index.md?The text was updated successfully, but these errors were encountered: