请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

请求apiclound 时报80端口,自己起的服务是3000

{

    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

}


正在回答 回答被采纳积分+3

4回答

旋涡鸣人_ 2018-11-09 09:41:59

request.get(`https://d.apicloud.com/mcm/api/${className}`...

写死就好了...

0 回复 有任何疑惑可以回复我~
慕尼黑4589406 2018-10-23 23:24:54

应该是你的axios的参数写错了, baseURL这个字段才对

0 回复 有任何疑惑可以回复我~
  • baseURL 不是这个吗
    https://d.apicloud.com/mcm/api/
    回复 有任何疑惑可以回复我~ 2018-11-09 09:15:58
aldksfj 2018-08-23 17:57:40

解决了嘛?我也遇到同样问题了


0 回复 有任何疑惑可以回复我~
Jokcy 2018-05-30 14:12:54

你在服务端发起apicloud的请求的时候是不是没写host

0 回复 有任何疑惑可以回复我~
  • 老师,请问服务端发起apicloud的请求在哪里写host??
    回复 有任何疑惑可以回复我~ 2018-11-12 16:36:37
  • Jokcy 回复 Crystal2030 #2
    host就是http://域名:端口
    回复 有任何疑惑可以回复我~ 2018-11-13 10:59:07
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号