Using serve-index middleware
Hi, I'm planning to switch an express application to total.js :). After I read the support of middlewares I thought I could use some packages for express in total.js (if total.js is based on connect for middlewares). However I don't find a way to make work this module.
I have the following code:
middleware.js
const serveIndex = require("serve-index");
F.middleware("serve-index", serveIndex("public/files", { "icons": true }));
uploadController.js
exports.install = function () {
F.route("/files", ["#serve-index"])
}
Thank you, I'd appreciate your help!
Hi, great. Yes, you could but I don't recommend it.
- Total.js supports handling of static files automatically (so
/app/public/are reallypublicdirectory) - for Express you had to find some modules always, but Total.js contains all what you need
- so don't find modules in NPM and always look to Total.js docs or write me on messenger.totaljs.com
@sant123 Hi, there's a module for Total.js that does almost the same as serve-index. Check it out https://github.com/totaljs/modules/tree/master/Miscellaneous/directorylisting
Everything working!!!!!. Thank you both for your help. :smile: