node.js TypeError: path must be absolute or specify root to res.sendFile [failed to parse JSON]

The error is pretty clear, you need to specify an absolute (instead of relative) path and/or set root in the config object for res.sendFile(). Examples: or specify a root (which is used as the base path for the first argument to res.sendFile(): Specifying the root path is more useful when you’re passing a user-generated file path which could potentially contain malformed/malicious … Read more