J
J
jsprog2019-10-20 20:02:35
Node.js
jsprog, 2019-10-20 20:02:35

What is the correct way to provide static files?

Hey! Can you please tell me how to make the provision of static files?
Here is my code:

app.use('/assets', express.static(__dirname + '/assets'));
app.use(express.static(__dirname + '/css'));
app.use(express.static(__dirname + '/js'));
app.use(express.static(__dirname + '/fonts'));
app.use(express.static(__dirname + '/images'));
app.use(express.static(__dirname + '/data'));

It turns out there is an assets folder in it under the folders: css, js, fonts, images and data.
I want such a huge code, to make it shorter and prettier.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question