jdx / jdx/mean-sample

Ch. 5 - complications due to use of sendFile() (the recommended express method)

Open
#40 1 comment 0 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.