###このAPIの使い方がわかりません。
https://github.com/ReiKohaku/BotArcApi_lib
具体的には、Usage の Create API の章の2番、「Make sure you deploy the domain name of BotArcApi, such as http://localhost:8088
.」について、これが何を意味しているのかわかりませんでした。
このAPIは、オンラインゲームのスコアを取得し、それをプログラム上で扱えるようにしてくれるものです。
###試したこと
試しにhttp://localhost:8088
について無視してUseApiの章のサンプルを実行してみたところ、エラーが出ました。
- 実行したコード
js
1'use strict'; 2 3const { BotArcApiV4 } = require("botarcapi_lib"); 4const api = new BotArcApiV4("http://localhost:8088", 60000) 5 6api.user.best30("Nagiha0798", true) 7 .then(console.log) 8 .catch(console.error);
- エラー
Error: connect ECONNREFUSED 127.0.0.1:8088 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 8088, config: { url: 'v4/user/best30', method: 'get', headers: { Accept: 'application/json, text/plain, */*', 'User-Agent': 'axios/0.21.1' }, params: { user: 'Nagiha0798' }, baseURL: 'http://localhost:8088', transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 60000, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], data: undefined }, request: <ref *1> 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, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false }, _events: [Object: null prototype] { response: [Array], error: [Function: handleRequestError], socket: [Function: destroyOnTimeout] }, _eventsCount: 3, _maxListeners: undefined, _options: { maxRedirects: 21, maxBodyLength: 10485760, protocol: 'http:', path: '/v4/user/best30?user=Nagiha0798', method: 'GET', headers: [Object], agent: undefined, agents: [Object], auth: undefined, hostname: 'localhost', port: '8088', nativeProtocols: [Object], pathname: '/v4/user/best30', search: '?user=Nagiha0798' }, _ended: true, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function (anonymous)], _currentRequest: ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Socket], _header: 'GET /v4/user/best30?user=Nagiha0798 HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'User-Agent: axios/0.21.1\r\n' + 'Host: localhost:8088\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/v4/user/best30?user=Nagiha0798', _ended: false, res: null, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'localhost', protocol: 'http:', _redirectable: [Circular *1], [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] }, _currentUrl: 'http://localhost:8088/v4/user/best30?user=Nagiha0798', _timeout: Timeout { _idleTimeout: -1, _idlePrev: null, _idleNext: null, _idleStart: 62, _onTimeout: null, _timerArgs: undefined, _repeat: null, _destroyed: true, [Symbol(refed)]: true, [Symbol(kHasPrimitive)]: false, [Symbol(asyncId)]: 9, [Symbol(triggerId)]: 5 }, [Symbol(kCapture)]: false }, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] }
BotArcApi_lib はどこかで動いてる BotArcApi にアクセスするためのライブラリで、まず BotArcApi を動かして、その場所を指定する必要があるってことでしょう。
あなたの回答
tips
プレビュー