2

I'm serving my static Linux files and folders using Express (as a server). There's no problem with my code. Still for the sake of clarification, I'm providing the code

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


var __dirname = "/media/user/"

app.use('/data', serveIndex(__dirname));
app.use ("/data", express.static(__dirname))

app.listen(3000, () => {
    console.log ("server listening at port 3000")
})

My actual problem is, I want to force my custom CSS styles (like changing font color, size of files & folders etc) to the display I'm getting upon visiting the localhost:300/data URL. This is the response I'm getting from express server

enter image description here

1 Answer 1

1

serve-index module has a way of passing path to custom stylesheet, try using stylesheet option when initializing it, like this:

app.use('/data', serveIndex(__dirname, { stylesheet: '/path/to/stylesheet/' }));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.