Ch. 5 - complications due to use of sendFile() (the recommended express method)
- Dominant language
- JavaScript
- Stars
- 165
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
As a result of moving over to sendFile(), I had to add __dirname to the path :. sendFile(__dirname+'...'), to get through the initial few pages of the chapter, otherwise I kept getting the "express deprecated res.sendfile ..." warning.
This was fine until pg. 62, where you separate out the sendfile endpoints. Here, the only workable solution I've found is to add a new object to the static.js file :. var path = require('path') and use its join method to cobble together a usable path for sendFile() :. res.sendFile(path.join(__dirname,'../relative/path/to/post.html').
The method mentioned in the book works fine, but since it is deprecated, I thought I'd try and learn the newer method.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.