Heroku(Cedar) + Node + Express + Jade Client-side javascript files in subdirectory work locally with foreman+curl but not when pushed to Heroku

大兔子大兔子 提交于 2019-12-04 04:00:34

I recommend you to use process.cwd() value to get specific directory

process.env.PWD = process.cwd()

at the very beginning of your web.js

let you access files easily.

You can do

app.use('/heatcanvas',express.static(process.env.PWD+'/heatcanvas'));

instead of using

__dirname

Warning: Make sure to execute web.js at the root directory of web.js (Heroku web.js are executed that way)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!