2014-09-21 49 views
0

我在/公/插件,help.html兩個文件和help.js的Node.js Express將不會成爲絕對URL .js文件

http://localhost:8084/widget/help.html 
地址欄正常工作

http://localhost:8084/widget/help.js 

未送達( '不能讓'),即使我的快遞使用的配置:

app.use(express.static(path.join(application_root, 'public'))); 

任何與相對路徑的HTML文件內的js服務良好。 (也就是說,如果我用

<script src="/widget/help.js"></script> 

生活是美好的,但

<Script src="http://localhost:8084/widget/help.js"></script> 

不提供早餐(我需要的絕對URL爲引用的遠程頁面的.js)

這裏。我的全力快速配置:

// parse application/x-www-form-urlencoded 
app.use(bodyParser.urlencoded({ extended: false })); 
app.use(bodyParser.json()); 
app.use(cookieParser()); 
app.use(morgan('dev')); // log every request to the console 
//checks request.body for HTTP method overrides 
app.use(methodOverride('X-HTTP-Method-Override')) //checks request.body for HTTP method overrides 
//Where to serve static content 
app.use(express.static(path.join(application_root, 'public'))); 

我必須做一些愚蠢的任何想法

!?
+0

你是什麼意思「忽略/不認識?」你得到了404還是什麼?你是直接在地址欄中輸入「http:// localhost:8084/widget/help.js」,還是用'