2
我已經在本地構建了一個強大的環回API服務器,並且一切正常,但是當我將它上載到遠程服務器時,SLC RUN命令運行正常(我可以在終端中看到它它實際上是在同一臺服務器上的MySQL數據庫中創建了我的測試模型),但是我無法訪問example.com/explorer頁面以查看這些API ......我是否需要配置不同的東西來使它在工作時處於工作狀態遠程服務器?Strongloop環回資源管理器不顯示何時在遠程服務器上
我將端口從3000更改爲3001.這是我在服務器文件中的config.json文件。
{
"restApiRoot": "/api",
"host": "www.example.com",
"port": 3001,
"remoting": {
"context": {
"enableHttpContext": false
},
"rest": {
"normalizeHttpPath": false,
"xml": false
},
"json": {
"strict": false,
"limit": "100kb"
},
"urlencoded": {
"extended": true,
"limit": "100kb"
},
"cors": {
"origin": true,
"credentials": true
},
"errorHandler": {
"disableStackTrace": false
}
}
}
,並在啓動目錄下的Explorer文件(是的,我是走故宮安裝回送管理器)...
module.exports = function mountLoopBackExplorer(server) {
var explorer;
try {
explorer = require('loopback-explorer');
} catch(err) {
// Print the message only when the app was started via `server.listen()`.
// Do not print any message when the project is used as a component.
server.once('started', function(baseUrl) {
console.log(
'Run `npm install loopback-explorer` to enable the LoopBack explorer'
);
});
return;
}
var restApiRoot = server.get('restApiRoot');
var explorerApp = explorer(server, { basePath: restApiRoot });
server.use('/explorer', explorerApp);
server.once('started', function() {
var baseUrl = server.get('url').replace(/\/$/, '');
// express 4.x (loopback 2.x) uses `mountpath`
// express 3.x (loopback 1.x) uses `route`
var explorerPath = explorerApp.mountpath || explorerApp.route;
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
});
};
你的意思是example.com:3001/explorer對不對? (而不是example.com/explorer)還是有一些代理服務器傳遞給您的節點實例? – pherris 2014-12-05 17:04:10
對不起,我的意思是example.com:3001/explorer...any想法爲什麼我有這個問題? – 2014-12-05 17:05:18
是在你連接的機器上打開的端口(http://stackoverflow.com/questions/9609130/quick-way-to-find-if-a-port-is-open-on-linux)?它是一個EC2實例嗎? – pherris 2014-12-05 17:22:39