options.index can now accept a function

pass path, resources and options to req.locals