N
N
Nicholas2016-05-18 06:23:54
Node.js
Nicholas, 2016-05-18 06:23:54

How to make folder substitution in node.js express static?

I can’t figure out how to do it (
There is a request to the web server on node.js express:

localhost:3000/hot/bla1.html or localhost:3000/hot/hot2/go3/bla1.html etc ..

node gives hot static folder via
app.use(express.static( './hot' ));
Everything is working! but I need to make a static substitution:
what would be on request:
localhost:3000/hot/bla1.html or localhost:3000/hot/hot2/go3/bla1.html etc ..

content from the hot777 folder was given

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nicholas, 2016-05-18
@ACCNCC

Решение:
app.use('/hot', express.static('hot777'));

D
Deodatuss, 2016-05-18
@Deodatuss

не пробовал

app.use(/^([^\/]*\/)*/, express.static(__dirname + '/hot'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question