In server.js we have used :-
app.use(’/’, express.static(__dirname + ‘/public’))
to load the html file.
can we use this :-
app.get(’/’, (req, res)=>{
res.sendFile(__dirname+’/public/index.html’)
})
to do the same function?
In server.js we have used :-
app.use(’/’, express.static(__dirname + ‘/public’))
to load the html file.
can we use this :-
app.get(’/’, (req, res)=>{
res.sendFile(__dirname+’/public/index.html’)
})
to do the same function?
Yes you can definitely use res.sendFile in response
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
but in res.sendFile it is not responding to change the code.value
I think I have cleared your doubt on whattsapp