divhide/node-grunt-http-server

Feature request: Specify landing page for root directory

JKVeganAbroad opened this issue · 6 comments

Specify a default landing page for root directory, retain showDir: true everywhere else.
Perhaps rootLanding: 'html/home.html' as an example.

Currently the landing page serves the auto-generated index of files.

(not sure if this should be requested on indexzero/http-server instead?)

Hi @JKAussieSkater, the grunt tasks just passes the showDir parameter to http-server module, which in it's turn is passing that to ecstatic module.

From what I can see on https://github.com/jfhbrook/node-ecstatic/blob/master/lib/ecstatic/showdir.js that's
not possible.

The alternative would be to set the before http-server callback to redirect to another page, e.g. /home.html

Is there a particular use case for this (curious about on what you would render on home.html )?

Sorry, I didn't explain myself properly.

When I navigate to http://0.0.0.0:8282/ I want it to display a "homepage.html".

Instead I get the contents of the root: '/foo/bar/' directory.

Is there an option to specify a homepage, so I don't have to navigate a directory file-tree?

Let me get back to you on that. I think the before middleware callback can be used for that.

Hi @JKAussieSkater I've just added the support to customPages that will help you with your landing page. Please take a look at the README.md.

Help the project by donating and spreading the word.

Let me know if you have any questions.

@aetheon, you're a super-human!
Thank you for this, I will definitely spread the word! So many will love this new feature!

I attempted to donate, but the link didn't work:
image

No worries @JKAussieSkater glad to help.