请求apiclound 时报80端口,自己起的服务是3000
来源:7-1 服务端api请求基础实现

如果_0003
2018-05-30
{
Error: connect ECONNREFUSED 127.0 .0 .1: 80
at Object._errnoException(util.js: 992: 11)
at _exceptionWithHostPort(util.js: 1014: 20)
at TCPConnectWrap.afterConnect[as oncomplete](net.js: 1186: 14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80,
config: {
adapter: [Function: httpAdapter],
transformRequest: {
'0': [Function: transformRequest]
},
transformResponse: {
'0': [Function: transformResponse]
},
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, */*',
'X-APICloud-AppId': 'A6070842681771',
'X-APICloud-AppKey': '28e81645d856be75d935d28ae457e129e860d105.1527657909318',
'User-Agent': 'axios/0.18.0'
},
method: 'get',
baseUrl: 'http://d.apicloud.com/mcm/api',
url: '/todo',
data: undefined
},
request: Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: true,
domain: null,
_events: {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'http:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/todo',
method: 'get',
headers: [Object],
agent: undefined,
auth: undefined,
hostname: null,
port: null,
nativeProtocols: [Object],
pathname: '/todo'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'GET /todo HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nX-APICloud-AppId: A6070842681771\r\nX-APICloud-AppKey: 28e81645d856be75d935d28ae457e129e860d105.1527657909318\r\nUser-Agent: axios/0.18.0\r\nHost: localhost\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/todo',
_ended: false,
res: null,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: [Circular],
[Symbol(outHeadersKey)]: [Object]
},
_currentUrl: 'http:/todo'
},
response: undefined
}
4回答
-
旋涡鸣人_
2018-11-09
request.get(`https://d.apicloud.com/mcm/api/${className}`...
写死就好了...00 -
慕尼黑4589406
2018-10-23
应该是你的axios的参数写错了, baseURL这个字段才对
012018-11-09 -
aldksfj
2018-08-23
解决了嘛?我也遇到同样问题了
00 -
Jokcy
2018-05-30
你在服务端发起apicloud的请求的时候是不是没写host
022018-11-13
相似问题