2017-07-08 49 views
0

我是新來的科爾多瓦。Cordova nodejs路由問題

我想用nodejs作爲後端來構建cordova應用程序。當我運行應用程序使用瀏覽器(科爾多瓦運行瀏覽器)它將我重定向到http://localhost:8000/index.html這很好。

我的問題是,當我登錄到網站瀏覽器重定向到「http://localhost:8000/home」,並給出未找到錯誤。我已經將routes.js設置爲「/ home」(nodejs後端)。

任何幫助將不勝感激。謝謝。

+0

張貼代碼視圖.. –

回答

0

你在什麼東西路由像

router.addRoute('name of view',function(){'your code here'}) 
+0

>在服務器端:** **的NodeJS(routes.js) 'app.get( '/登錄' ,功能(REQ,RES){ \t \t如果(login.auth(REQ,RES)) \t \t \t res.redirect(主機+ ':8080 /家'); \t \t別的 \t \t \t res.render ('index.htm的升'); \t}); \t app.get( '/家',功能(REQ,RES){ \t \t如果(login.auth(REQ,RES)) \t \t \t res.render( 'home.html做爲'); \t \t else \t \t \t res.redirect(host +':8080/login'); });' ** cordova app **上沒有路由。我是否也必須在cordova應用上進行路由? –