0
votes

I have these following files in my folder. I want to show the public folder from index.js using express. At first, I used app.use(express.static('public')) and it works on my localhost but when I deployed it it doesn't work. Can anyone show me how to do this?

(in case the pic doesn't work:

public folder(index.html,style folder,js folder)

.gitignore

.env

index.js)

files

1

1 Answers

0
votes

Maybe this is an issue with relative pathing, try replacing your current code with this:

  • app.use("/", express.static(__dirname + "/public"));