Noosphere Possibilities Maximized

npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

express-index

0.2.3 • Public • Published

express-index

NPM

What is this?*

express-index an express middleware used to generate simple and easy directory indexes.

Install

npm install --save express-index

Usage

var express = require('express');
var exindex = require('express-index');
var app     = express();
 
app.use("/", express.static("public"));
app.use("/", exindex("public", { theme : "darko" }));
 
app.listen(80);

Custom Errors

var options = {
    error : {
        // Not Found
        404 : function(req, res){
            res.send(req.url + " - Resource not found!");
        },
        // Forbidden
        403 : function(req, res){
            res.send("You shall not pass!");
        }
    }
};

Then pass the options to the route:

app.use("/", express.static("public"));
app.use("/", exindex( "public", options ));

Templates / Themes:

  • default
  • default-noimg
  • hackerman
  • darko
  • boxy

Additional Notes

  • Please report any issues here

install

npm i express-index

Downloadsweekly downloads

15

version

0.2.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability