1

I have a problem using express, this code:

server.use('/', express.static(resolve('dist', 'login')))

is redirecting any get request to file to "http://server.test/{filename}/" with a slash at the end

I have the following directory structure

dist
|-- backoffice
|   |-- 15cf1ad46c733a3f7047.png
|   |-- 57bb47614115fe858bc9.png
|   |-- 7ab96de21ca6d0bb473e.png
|   |-- favicon.png
|   |-- index.html
|   |-- main-cb65c5eebc155574cd10.js
|   |-- main-cb65c5eebc155574cd10.js.LICENSE.txt
|   `-- main-cb65c5eebc155574cd10.js.map
`-- login
    |-- 15cf1ad46c733a3f7047.png
    |-- 7ab96de21ca6d0bb473e.png
    |-- da022ba8e008095943d1.png
    |-- favicon.png
    |-- index.html
    |-- main-32ad7eed217498f4ac9c.js
    |-- main-32ad7eed217498f4ac9c.js.LICENSE.txt
    `-- main-32ad7eed217498f4ac9c.js.map

when I request GET / i'm successfully redirected to index.html but once index html try to load js file it result a 404

I have no ideas of what i'm doing wrong

because same logic is working with this code

server.use('/', express.static(resolve('dist')));

with this directory structure

dist
|-- 15cf1ad46c733a3f7047.png
|-- 57bb47614115fe858bc9.png
|-- 7ab96de21ca6d0bb473e.png
|-- da022ba8e008095943d1.png
|-- favicon.png
|-- index.html
|-- main-990802835ccf4ee2b154.js
`-- main-990802835ccf4ee2b154.js.map

everythings works as expected ..

Thanks in advance for answers

Alex
  • 21
  • 2

0 Answers0