Skip to content
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

Example code doesn't work properly #64

Closed
readyready15728 opened this issue Aug 22, 2017 · 1 comment
Closed

Example code doesn't work properly #64

readyready15728 opened this issue Aug 22, 2017 · 1 comment
Assignees
Labels

Comments

@readyready15728
Copy link

I followed the advice down at the bottom of README.md more or less, coming up with the following:

'use strict';

const express = require('express');
const serveIndex = require('serve-index');

express()
  .use(serveIndex(__dirname + '/public'))
  .listen(1024);

It lists the files in the directory and formats the results nicely. Bravo. The problem is that, when I click any of those files, it doesn't do what the more laborious example above it in README.md appears to be able do using vanilla Node features. In fact it says Cannot GET /blablabla.

Is there some straightforward, concise way of getting it to function using Express components? Forgive me if I'm not quite thinking this through. In any case, that / those extra step(s) should be added to the example so it works properly.

@dougwilson dougwilson self-assigned this Sep 29, 2017
@dougwilson
Copy link
Contributor

Yea, sorry, the express example needs to include express.static. I updated the example, which should be what you're looking for :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants