Support serving files with default extension #27

Merged
merged 1 commit into from Nov 13, 2012

Conversation

Projects
None yet
1 participant
@indexzero
Owner

indexzero commented Nov 10, 2012

Adds ability to serve files with default extension both from the http-server binary and programmatically.

http-server binary

  #
  # A request to /a-file will also try to serve /a-file.html
  #
  http-server /path/to/public -e

  #
  # A request to /a-file will also try to server /a-file.json
  #
  http-server /path/to/public -e json

programmatic usage

  //
  // A request to /a-file will also try to serve /a-file.html
  //  
  var server = require('http-server').createServer({
    root: '/path/to/public',
    ext: true
  });

  //
  // A request to /a-file will also try to serve /a-file.json
  //  
  var server = require('http-server').createServer({
    root: '/path/to/public',
    ext: 'json'
  });

Note: This requires the pull-request on ecstatic to be merged

indexzero added a commit that referenced this pull request Nov 13, 2012

Merge pull request #27 from nodeapps/defaultExt
Support serving files with default extension

@indexzero indexzero merged commit f5790a2 into master Nov 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment