2015-10-04 87 views
0

我在我的应用程序中同时运行nodejs和php,但只能使用一个端口。所以我想要做的就是让在的NodeJS端口上的用户,然后通过路由给的index.php给用户,这样的:通过nodejs socket.io服务PHP

app.get("index.php") 

有没有人对我怎么可能什么想法做这个?非常感谢...

回答

0

你可以尝试将你想用的index.php文件放在package.json文件中,作为你的应用程序的主要入口点。只需用您自己的网址替换主要媒体资源。

的package.json:

 { 
    "name": "NodeTesting", 
    "description": "Used for node testing and developing scripts", 
    "version": "0.0.1", 
    "main": "http://localhost/launchjs/index.php", 
    "author": { 
     "name": "bytewarestudios", 
     "email": "[email protected]bytewarestudios.com" 
    }, 
    "keywords": [], 
    "licenses": { 
     "type": "none" 
    }, 
    "repository": { 
     "type": "git", 
     "url": "git://github.com//bytewarestudios" 
    }, 
    "bugs": { 
     "url": "http://github.com//NodeTesting/issues" 
    } 
}