I have a server with files like this:
- index.js
/client
-index.html
-about.html
-signup.html
-style.css
In index.js I have a express server.
/
, it should go to index.html/about.html
it should go to about.html etc/style.css
it should go to style.css etc..I know you can do it like this..
app.get('/', (req, res) => {
res.sendFile(__dirname + '/client/index.html')
})
But I want to make it so that it automatically sends the correct file without having to get
each folder.
I know it has something to do with app.use
but I am not fully sure how to use it.
Whoops, I never thought it would be this easy-
app.use('/', express.static('client'))